Copy Data From One Table Into Another with PopTabFmClip

Everyone knows you can copy and paste text from one InDesign document to another, or from another application into your InDesign document. You can even control whether the text formatting is saved or discarded:

  • If the text comes from outside InDesign, you can choose to keep or discard the formatting in the Clipboard Handling pane of the Preferences dialog box.
  • If the text comes from the same or another InDesign document, you can strip out the formatting by choosing Edit > Paste without Formatting.

Unfortunately, these rules don’t fully apply to tabular text (text from one or more table cells). In particular, there is no way to strip out the formatting when you paste tabular data from one InDesign document to another (or one table in your document to another, or even from one part of an InDesign table to another part). That’s a problem, but there’s an easy solution, which I’ll show you in a minute.

First I need to explain one thing quickly: To copy and paste more than one cell of tabular data, you need to:

  1. Select all the cells you want to copy (you can probably just drag over them with the Type tool);
  2. Select one or more cells in the table you want to paste the data into. To make it easy, click inside the upper-left cell in the range with the Type tool (so that the cursor is flashing in that cell) and then press Esc (escape). That’s a shortcut for selecting the cell itself (rather than the text inside the cell).
  3. Paste.

If you copied cells from another program (such as Excel or Word), the formatting is automatically stripped out when you paste into InDesign. That is, the numbers or text from the cell are formatting based on whatever cell formatting already existed in InDesign. (Well, actually, if you have your Clipboard Handling preference set to retain all style formatting, then it really messes up the paste, placing a new table inside the first cell of the table. It’s ugly! Don’t do that.)

However, if you copied the cells from another InDesign table, then when you paste, it takes the formatting along for the ride. You might try to choose Paste Without Formatting, but — oddly — that feature is disabled for tabular data. Oops.

Okay, so here’s the trick: Use the free PopTabFmClip script (also known as PopTabUnleashed), written by Dave Saunders. Yes, this script wins the prize for the worst name in InDesign history, though it makes a bit more sense if you remember that it stands for “populate table from clipboard.” And because it’s so incredibly useful, Dave is forgiven the name. :)

Dave originally wrote this many years ago, but has just recently updated it to work with the newest version of InDesign.

(Remember, to install scripts: Open the Scripts panel from the Window menu; right-click on the User folder inside the panel; select Reveal in Finder/Explorer; place the .jsx script (not a zip file) inside the Scripts Panel folder; return to InDesign and look inside the User folder in the Scripts panel; double-click the script to run it.)

If none of that explanation made sense, here it is in visual form:

Here are two InDesign tables (granted these are really ugly, but I’m just trying to explain something here):

pasting tabular data

After I select the first two rows in the top table and paste them into the first two rows of the second table, you can see that the second table’s formatting is wiped out:

Poptab2

Now, let’s undo, then try it again, this time using the PopTabUnleashed script to do the “pasting”:

pasting with poptabfmclip

Now just the data shows up, formatting the way it should in the second table. Bravo!

Tags
Related Articles
Comments

9 Comments on “Copy Data From One Table Into Another with PopTabFmClip

  1. Cool. Thank you, Dave!

    But be aware, that inline or custom anchored objects don’t travel over. Technically thiese are part of the formatting information and not part of the pure “contents” property the script is using.

    Same is true when alternative glyphs of a OpenType font are used (even if source and target paragraph style use the same font).

    Uwe

  2. Hi David,
    I am gonna give it a try with the latest ID version I have to see it working. (Thanks Dave, and David).

    Though I have used often a manual roundup, of duplicating the table, or rows to be pasted, convert them to tabular text, select them and now I can paste without format* on selected cells.
    And yes, do not forget to select a cell as a starting point, place the text cursor inside it and press ESC key to select it. (When placing, the cells at right and below will be populated).

    (*) I better understand “Paste without formatting” definition, as a pasting where text gets and keeps the current styling.

  3. I just convert the source table to text. Copy the the text and paste it into the target table :) using the Paste Without Formatting (CTRL SHIFT V)

    But a script is fun too :D

  4. Eugene wrote: “I just convert the source table to text.”

    @Eugene: you will run into problems with this method if your source cells contain tabs and/or paragraph returns.

    Uwe

  5. There are times when those things are required. It’s not perfect solution. But it’s what I do without a script. The script is a great option.

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>