Fan of creative technology, elearning, instructional design and a little geeky

Sort it please… (2)

Adobe InDesign CS4, Sorting with Scripts.

This is the second part of a two part write-up about sorting paragraph and table text in InDesign and covers the sorting of table data, thanks to a great script developed and provided freely by Peter Kahrel.

Sorting Table Columns

Sorting Table data is not something the SortParagraphs.jsx script that comes installed as a Sample script in InDesig does. Unless you first convert the Table to Text, then sort based on the ‘first column’ and recreate the table. However, if the table has already been created and been nicely designed that might not be an option. In addition, you could only sort on the first column in that case… and not choose to sort on another column.

Peter Kahrel, UK-based InDesign Scripter extraordinaire has been kind enough to release a free script that allows you to sort table data, amongst a myriad of other scripts.

Sort Tables script from Peter Kahrel.

This might be the first time you’ve gone through the steps of downloading a script for use in InDesign. I’ll take you through the process of downloading and installing the script in InDesign. Believe me it’s a pretty painless process.

To download the script from Peter Kahrel’s site, Right-click the Show Script button. Depending on which browser you’re in the contextual menu that appears might be a little different. I’m using Mozilla Firefox here, and this has a Save Link As… option.

094_07_DownloadSaveLinkAs

The Save Dialog Appears. At this stage, I’ll just save the script SortTable.jsx  to the Desktop. Your browser might download into a Downloads folder.

How to install scripts in InDesign

We’re now ready to install the script so we can run it from within InDesign, but must first install it. InDesign Scripts can be installed in two different locations:

  • At Application level, which makes the Script accessible to all users on the workstation. E.g. regardless of which user account is used upon startup
  • At User level, which makes the Script accessible only to the current active user.

If you’re into sharing Scripts with your mates who use the computer on which you’re installing the script, than install at Application level!

Ensure the Script Panel is visible (Window > Automation > Scripts).

Click the Application folder in the scripts panel, then from the panel menu choose Reveal in Finder (on Windows this will say Reveal in Explorer), alternatively right-click the Application folder

094_08_RevealInFinder

The Scripts Panel folder inside the InDesign application folder on your computer is selected. Double click this folder to open it.

You’ll notice that this is the folder that contains the Apple and Java samples Scripts 🙂

094_09_Folders

The folder hierarchy you see here is identical to what you see in the Scripts panel. If you want to organise your scripts a little you can create additional folders inside the Scripts Panel directory. I’m adding a folder called myOtherScripts.

094_10_NewFolder

Next copy the previously downloaded script into the Scripts panel folder (or sub-directory there-of).

094_11_NewScriptAdded

Time to check if the Script is now visible in InDesign (there is no need to relaunch InDesign when you add a script).

094_12_NewScriptAdded_2

That’s it we’re now ready to start sorting some table data. The script allows you to either sort a particular range of data, or all of the table data.

  • To sort based on data range, highlight some cell data in the column that is the trigger for the sort order you want to generate
  • To sort the entire table, simply insert your cursor anywhere in the column that is the trigger for the sort order.

In my example I want to sort the entire table, based on the data in the very first column. So I use my Type Tool and click in one of the cells in the first column.

Next it is time to run the script. This time I’m double clicking the script in the Scripts panel (to learn more about running scripts refer to the first part of this 2-part “Sort it please…” series.

094_12_TableSortBefore

I’m placing my cursor in one first body cell of the first column (“Road with Pollard…”), and going for the Double Click to run the script option.

Running the tablesort.jsx script triggers a dialog prompt that asks for some input.

094_13_TableSortOptions

I’ll be sorting in Ascending order (A-Z) and my data is alphanumberical (combination of numerical and alphabetical characters). The script is smart enough to pick up that the Table I’m sorting contains a Header Row.

For a detailed write-up of the script functionality, please refer to Peter Kahrels accompanying post to the Script.
http://www.kahrel.plus.com/indesign/tablesort.html

Once the Table Sort Options are set, click OK… and wait a little while (long tables might take some seconds to fully complete their sorting).

and ta-daaaahhh… one beautifully sorted table…

094_14_TableSortAfter

A special thank you goes out to Peter Kahrel, who’s made this script available to us InDesign lovers! Thank you Peter!

Similar posts
  • Adobe InDesign and XML: A Reference Guide The following is a reference guide I have compiled over time for those of you who are looking at doing a little more with XML in InDesign (originally published Feb. 2011, last updated Feb 2018). If you have any extra information you’d like to see added to this guide, feel free to message me. Mapping XML tags to InDesign [...]
  • How to change the colour of bullet points in InDesig... A few weeks ago I recorded a short quick tip tutorial. InDesign’s Control panel, gives users a quick and easy way to format text as a bulleted list. Highlight the text, and click the Bulleted List button in the Paragraph Formatting Controls mode for the Control panel. This applies a universal bullet character as the [...]
  • Creating a pop-up window in a PDF with Adobe InDesig... In the following YouTube tutorial, we’ll create an interactive PDF from Adobe InDesign, in which we click on a button, which in turn opens up a simple pop-up window containing a close-box. When the close-box is clicked the pop-up window disappears [...]
  • InDesign: Facing pages with odd-numbered left pages Back in 2004 I wrote a tip for InDesign CS on how you could have the first page of your document be a left page AND have it start with page number 1. It’s hard to believe this is almost a decade ago… But a recent question on Facebook, made me think I should really [...]
  • Negative Lookbehind – GREP for Designers This is the fourth and final blog-posts in a series of posts on lookaheads and lookbehinds in GREP, written after speaking at the Perth InDesign User Group. My speaker notes are also available: What is GREP? (PDF download) (2.4Mb). In the previous three posts I briefly introduced GREP, and we took a look at Positive [...]

3 Comments

  1. Violet Cactus Violet Cactus
    February 13, 2014    

    You absolutely rock, Cari. THANK YOU!

  2. Joakim Joakim
    January 28, 2012    

    Thanks! This saved me hours of work…!

    • February 17, 2012    

      Always nice to hear my tips help improve productivity. Thanks Joakim 🙂

Leave a Reply

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