Copying Columns from Grid to Clipboard in SQL Developer

thatjeffsmith SQL Developer 9 Comments

Tell Others About This Story:

There are several ways to get data from a query or a table|view to the clipboard. You know the tried and true, copy and paste. But what if you only want one or more columns, not every column? There are several ways to do this, let’s see if we can’t identify all of them.

Write your query to only include the data you want

Obvious? Yes. Needed to be said? Definitely. The best tuning tip is to only ask for the data you need, only when you absolutely need it. But let’s look at a few more practical ways to do this.

Hide the unwanted columns

Mouse right click on an column header. In the context menu, select ‘Columns.’ Hide the columns you don’t want. Copy and paste.

WYSIWYG Grids, Hide Columns and Filter Rows

Mouse select the columns

Obvious, but a bit painful. For a very large dataset, you’ll be holding down the Shift and PageDown buttons – but it works. Remember to use Ctrl+Shift+C to get the column headers with the data.

Use the Export Wizard

This used to be called ‘Unload’ – agreed, not a great name. So, we changed it.

In a grid, right mouse click on the data, and on the context menu, select ‘Export…’

Select your format – I suggest ‘delimited’ or ‘fixed’ for copying data to the clipboard.

You can export to the clipboard, yes you can!

Click ‘Next.’

Click in the Columns dialog, and choose the columns you want copied.

Trim the columns you don't want copied

Click ‘Finish.’

Alt or Ctrl tab to your window or application of choice.

And Paste!
[text] "FIRST_NAME" "LAST_NAME"
"Donald" "OConnell"
"Douglas" "Grant"
"Jennifer" "Whalen"
"Pat" "Fay"
"Susan" "Mavris"
"William" "Gietz"
"Alexander" "Hunold"
"Bruce" "Ernst"
"David" "Austin"
"Valli" "Pataballa"
"Diana" "Lorentz"
"Daniel" "Faviet"
"John" "Chen"
"Ismael" "Sciarra"
"Jose Manuel" "Urman"
"Luis" "Popp"
"Alexander" "Khoo"
"Shelli" "Baida"
"Sigal" "Tobias"
"Guy" "Himuro"
"Karen" "Colmenares"
"Matthew" "Weiss"
"Adam" "Fripp"
"Payam" "Kaufling"
"Shanta" "Vollman"
"Kevin" "Mourgos"
"Julia" "Nayer"
"Irene" "Mikkilineni"

[/text]

There’s probably at least 2 or 3 more ways, but…

But, try these and let me know how we can improve things.

I’ve already gotten a request to be able to include the SQL text used to populate the dataset on the the copy to clipboard, and it’s now on our to-do list 🙂

Related Posts Plugin for WordPress, Blogger...
Tell Others About This Story:

Comments 9

  1. Hi Jeff. First, thanks again for the good work done on SQL Developer, and I mean it. By the way I wish you were working on JDeveloper also so that quality can be better on this software than it is now (talking about using it with ADF).
    Anyway, my suggestion is : … I like the Ctrl+Shift+C trick and I like shortcuts also.
    But I always forget about this one and I think most people don’t know about it too. So will it be possible to include this as an entry in the right click menu on the datagrid ?
    As for now there is only 5 entry and nothing about this possibility.
    I know I can also right-click on the header but the “copy header” on this menu doesn’t work the same way (it copies column names separated by commas, which is not very interesting if you want to paste the datagrid and its headers in Excel).
    That would be not that much work and can help people.
    Thanks

    1. thatjeffsmith Post
      Author
  2. I have generally been using an older product called Benthic Golden for basic querying in Oracle, but I’m trying to switch over completely to SQL Developer, since it is a more powerful tool. However, one of the features that makes copying grid results to clipboard so easy in Golden is that I can right-click on the grid and select one of the following options… Copy Selection, Copy All (W/O Titles), Copy Selection with titles, Copy All with titles, Copy Titles Only.
    After reading the post above, I now realize that a single click in the grid (to get focus), followed by a Ctrl+A (to select the entire grid), followed by a Ctrl+Shift+C (to copy with headers), will be my equivalent to right-clicking in Golden and selecting ‘Copy all with titles’. Could these right-click options be a future enhancement to SQL Developer?

    1. thatjeffsmith Post
      Author

      Welcome to the world of SQLDev!

      Did you know you can copy headers only? Right click on the column headers, Copy Selected Column Header(s)

      They could indeed be future enhancements. You can add those to our Exchange and see what others think of them.

  3. I used the last method suggested, ie pasting the data (in the one column) then doing text-columns as tab delimited. Now, whenever I paste it puts the data in columns *happy dance*

    1. thatjeffsmith Post
      Author

      Hi Monika, thanks for sharing your question and supplying your own answer! I’m wondering what you did to work around your issue? Did you use the text – column trick suggested on that link? I use OpenOffice, and when I do a paste into a spreadsheet it shows the data coming over on the clipboard as tab delimited.

  4. I’m using ctrl + c to copy multiple columns…. but then in Excel it pastes all into one column.
    This started when I changed my pc from xp to Win 7… any ideas? It’s driving me insane.

Leave a Reply

Your email address will not be published. Required fields are marked *