Join David Blatner for an in-depth discussion in this video 232 Swapping column and row information in tables, part of InDesign Secrets.
- [Voiceover] Sometimes you have a table in InDesign in which you want to swap, or switch, the columns and rows. For example, I might want all the information in this first row to become part of the first column, and the second row should be the second column, and so on. Now, there's no obvious way to do this in InDesign, but you can do it with a little trick, in fact, three tricks. You could use Excel, you could use a free script, or you could use an excellent plugin. I'll show you all three, but first, let me show you how you can do it in Excel.
Now, the Excel trick works best when your table is relatively simple and you don't have any formatting, like this one. To get the data into Excel, we first need to select all the cells in the table. I can do that by simply placing my text cursor inside any one of the cells, and then pressing cmd + opt + a on the Mac, or ctrl + alt + a on Windows. That selects all the cells. Then, I'll copy all that data to the clipboard by pressing Command + C on the Mac, or Control + C on Windows. Now, I'll switch to Excel, and you can see I have a blank worksheet open here.
All I need to do is paste, Command + V or Control + V on Windows. You can see all that data shows up inside the Excel document. OK, so there's the data, looking pretty much the same as it did in InDesign, except it's not formatted. I now need to deselect these cells, and then select them again and copy them to the clipboard one more time. Yes, you really do need to select and copy all those cells again in order to take advantage of a special Excel feature, which you can find in the Edit menu.
First, I'll select any other cell down here, then I'll go to the Edit menu, and I'll choose Paste Special. The Paste Special dialog box gives me all kinds of options, but all I need to do here is turn on the Transpose check box, and click OK. The data is pasted back into this worksheet, and you can see that it's now transposed. What was a column is now a row, and vice versa. Now I can copy those cells one last time, head back to InDesign, but before I paste, I need to pay attention to something.
This table, the original table, had four columns and five rows. However, my new table is going to have just the opposite. Before I paste, I want to make sure my table has the right number of columns and rows. I can change that up here in the control panel. I'll change this to four rows instead of five, and InDesign warns me that it's going to delete some of the data, that's OK, and I'm going to add one column. There we go. I now have the right number of rows and columns, so now I can paste with Command + V or Control + V on Windows.
There you go. All the data is put back in the table, but in the new order. Oh, actually, I should point out two reasons why this might not work for you. For some people, when they paste, the whole table ends up sitting inside the first cell of the InDesign table. If that happens to you, then you might not have had all the cells selected when you pasted, or you might need to make a small change to your preferences. I'll open my Preferences dialog box by going to the InDesign menu on the Mac, or the Edit menu on Windows, and then choosing Preferences.
Inside the Preferences sub-menu, I'm going to choose Clipboard Handling. Inside the Clipboard Handling pane of the Preferences dialog box, I want to make sure that this When Pasting Text and Tables from Other Applications section is set to Text Only. If I choose All Information, then sometimes, those pasted tables don't come in correctly. When I'm pasting tables, I want to choose Text Only. I'll just cancel out of this dialog box, because in this case, it worked just fine, As I said, this technique using Excel works pretty well when you have a simple table, but I'll scroll down just a little bit here, and you can see I have a little bit more complicated table here.
It's formatted, it has more rows, and so on. This is where the second solution comes in. When I was researching this problem of transposing rows and columns, I discovered an old script from way back in 2006, written by Iain Anderson. You can find this script on his blog, called funwithstuff.com, and amazingly, this old script seems to work just as well today in InDesign CC as it did back then. Now, we've covered how to download and install scripts in another InDesign Secrets movie, here in the online training library, so I'm not going to cover that here.
I've already downloaded and installed this one, and you can see it back here in InDesign, inside my Scripts panel, which I can find by going to the Window menu, choosing Utilities, and then choosing Scripts. There it is; Table Transpose. Now, I should point out that when you run this script, you need to select not the table, but the text frame that contains the table. I'll choose the Selection tool, the black arrow Selection tool, select this text frame here, and then run the script by double-clicking on it.
Boom! In just a few seconds, the rows and columns are all switched. I love that!. The last method that I want to point out is the Active Tables plugin, and you can find that on the DTP Tools site at dtptools.com. This plugin is a commercial tool, that is, you do have to pay extra for it, but it has a wide array of cool table features, not just transposing tables, but far more, like doing table calculations. It can actually do the math inside your tables.
Now, I'm not going to demo this plugin, but if you do a lot with tables, you should definitely check it out to see if it would save you time. Lastly, I do want to point out that if your table is complicated, particularly if it has merged or split cells, then all bets are off with any of these techniques. There's really no good way to transpose those, but, for a simple table that needs flipping, any of these techniques should do the trick.
Updated
12/23/2020Released
8/25/2011New techniques will be added to the collection every other week, so check back early and often. Find more tips and tricks at indesignsecrets.com.Note: Because this is an ongoing series, viewers will not receive a certificate of completion.
Skill Level Intermediate
Duration
Views
Q: Why can't I earn a Certificate of Completion for this course?
A: We publish a new tutorial or tutorials for this course on a regular basis. We are unable to offer a Certificate of Completion because it is an ever-evolving course that is not designed to be completed. Check back often for new movies.
Related Courses
-
InDesign: Interactive PDFs
with David Blatner2h 27m Intermediate -
InDesign CC to EPUB
with Anne-Marie Concepción4h 35m Intermediate -
InDesign CC 2019 Essential Training
with David Blatner5h 23m Beginner -
InDesign Quick Start
with David Blatner22m Beginner
-
This Week's Secret
-
Introduction
-
Welcome to InDesign Secrets1m 10s
-
-
December 2020
-
November 2020
-
October 2020
-
September 2020
-
Use one frame, not many4m 37s
-
August 2020
-
July 2020
-
June 2020
-
May 2020
-
Threading filled frames3m 14s
-
Custom page numbering tricks5m 13s
-
November 2012
-
October 2012
-
061 Embedding images7m 44s
-
-
September 2012
-
057 Text wrapping6m 54s
-
-
August 2012
-
July 2012
-
June 2012
-
May 2012
-
April 2012
-
March 2012
-
January 2012
-
April 2020
-
Making speech bubbles3m 32s
-
Working with ligatures5m 9s
-
February 2012
-
December 2011
-
016 Running a script9m 33s
-
November 2011
-
October 2011
-
August 2011
-
September 2011
-
March 2020
-
February 2020
-
Auto-expand acronyms4m 39s
-
-
January 2020
-
December 2019
-
November 2019
-
October 2019
-
409 Copy and paste effects4m 39s
-
-
September 2019
-
408 The master page trick1m 46s
-
August 2019
-
July 2019
-
June 2019
-
May 2019
-
April 2019
-
March 2019
-
February 2019
-
376 Make cast shadows3m 35s
-
-
January 2019
-
November 2018
-
December 2018
-
369 Shared CC Libraries tips5m 15s
-
October 2018
-
360 Find spacing problems4m 50s
-
363 Export all text8m 16s
-
-
August 2018
-
351 Change default fonts5m 51s
-
352 Best default RGB4m 45s
-
-
September 2018
-
July 2018
-
May 2018
-
343 Border spacing fix4m 59s
-
June 2018
-
346 Export to HTML55m 38s
-
April 2018
-
February 2018
-
March 2018
-
January 2018
-
325 Link text frames6m 10s
-
December 2017
-
November 2017
-
September 2017
-
October 2017
-
313 Quick Apply preferences6m 35s
-
August 2017
-
July 2017
-
May 2017
-
290 Work with scripts3m 35s
-
June 2017
-
April 2017
-
286 How to format ellipses5m 39s
-
March 2017
-
281 Share a CC library7m 10s
-
January 2017
-
February 2017
-
December 2016
-
271 Add images to an index4m 39s
-
November 2016
-
September 2016
-
October 2016
-
260 Batch process images7m 33s
-
263 Sync master pages5m 51s
-
-
August 2016
-
July 2016
-
June 2016
-
April 2016
-
May 2016
-
240 Side-by-side tables5m 35s
-
March 2016
-
February 2016
-
228 Setting text at an angle6m 24s
-
December 2015
-
January 2016
-
222 Adding paragraph shading1m 50s
-
October 2015
-
November 2015
-
September 2015
-
July 2015
-
August 2015
-
204 Creating a8m 14s
-
205 Managing scripts5m 38s
-
May 2015
-
189 Placing InDesign files5m 14s
-
-
June 2015
-
193 Printing tracked changes5m 41s
-
-
April 2015
-
186 Making long shadows5m 41s
-
February 2015
-
March 2015
-
January 2015
-
December 2014
-
November 2014
-
October 2014
-
September 2014
-
August 2014
-
July 2014
-
148 Cropping with paste into5m 18s
-
-
June 2014
-
May 2014
-
141 Inserting glyphs6m 42s
-
April 2014
-
March 2014
-
February 2014
-
January 2014
-
December 2013
-
November 2013
-
October 2013
-
September 2013
-
August 2013
-
105 Working with MiniBridge5m 45s
-
106 Customize your QR codes6m 17s
-
July 2013
-
June 2013
-
May 2013
-
April 2013
-
March 2013
-
February 2013
-
December 2012
-
069 Ten uses of the Story Editor11m 39s
-
-
January 2013
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.
CancelTake notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.
Share this video
Embed this video
Video: 232 Swapping column and row information in tables