Switching Rows and Columns in an InDesign Table

Sometimes you have a table in InDesign that looks like this:

A B C
D E F
G H I

But you want it to look like this:

A D G
B E H
C F I

That is, you want to transpose (switch) the columns and rows so that the content “flows” down the first column, then down the second column, and so on.

There is no obvious way to do this in InDesign, but you can do it either with the help of Excel, a free script, or an excellent plug-in.

The Excel Route

As long as the table is relatively simple, the easiest and fastest route is to:

  1. Select all the cells (click in one cell and then press Command-Option-A, or Ctrl-Alt-A)
  2. Copy them to the clipboard (Cmd/Ctrl-C)
  3. Switch to Microsoft Excel and open a new document
  4. Choose Edit > Paste
  5. Then select the cells again and copy them to the clipboard. (Yes, you need to do this again, in order to take advantage of the next feature.)
  6. Choose Edit > Paste Special
  7. In the Paste Special dialog box, turn on the Transpose checkbox:
    Transpose in excel

When you click OK, the table will be reversed! Now you can copy the cells one last time, return to InDesign, and paste (assuming the table cells are still selected there).

(If, when you paste, it doesn’t look right — for example, if the whole table ends up in the first cell of the InDesign table — then it’s possible that you need to open InDesign’s Preferences dialog box, choose the Clipboard Handling pane, and set the “When Pasting Text and Tables from Other Applications” to “Text”.)

Here’s an example… before and after:

Transpose2

Transpose3

The Script

In trying to find a solution for this problem, I discovered an old script from 2006, written by Iain Anderson. Amazingly, it seems to work just as well today, in InDesign CC, as it did back then. Here’s our InDesign FAQ, which includes links on how to install scripts.

Note that when you run this script, you need to select the text frame (not the table), and it will only affect the first table in the story.

The Plug-in

The ActiveTables plug-in, which we mentioned back on this article and which you can also find on the DTP Tools site, has a wide array of cool table features. If you’re using InDesign CC, you can get Active Tables as part of the DTP Cloud option (all the DTP Tools plug-ins for one low price per month or per year).

Of course, if your table is complicated (with merged cells and so on), all bets are off with any of these techniques. But for a simple table that needs flipping, these techniques should do the trick!

Bookmark
Please login to bookmark Close

This article was last modified on July 8, 2021

Comments (6)

Leave a Reply

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

Loading comments...