1 Reply Latest reply on Feb 12, 2014 1:33 PM by Mary Posner

    [AS] Import cell range into InDesign CC

    allisonblake Level 1

      I have recently upgraded to InDesign CC and Office 2011 for Mac and a script that I wrote for CS5 and Office 2004 no longer works. Specifically, the instructions to place a specified cell range from Excel is being ignored. The entire spreadsheet is being placed, with disastrous results. If I re-save the xlsx file to the legacy format xls, the script works as desired.

      Here's the snippet of code that used to work:

       

      tell application "Adobe InDesign CC"

             

              set properties of excel import preferences to {range name:importRange, table formatting:excel unformatted table}

      --importRange is a string based on the actual content of the spreadsheet, such as "A5:E128" The script doesn't work, even if I hard-code the range into the properties of the import preferences.

      ....

       

      tell page 1

                      set myPlace to place alias (filePath as string) autoflowing yes without showing options

      --filePath is the path to the Excel file. It places, but doesn't respect the import range specified above

      ...

       

      Interestingly, if I change the above to _with_ showing options, that also gets ingored. It doesn't open the import options dialog.

       

      Is there different verbiage I should be using for specifying import options for Excel files that are saved as xlsx? I couldn't find the AS scripting guide and sample scripts for CC as there was for CS5.

       

      Any help would be much appreciated.

        • 1. Re: [AS] Import cell range into InDesign CC
          Mary Posner Level 3

          From what I'm seeing in other threads on this topic, it's not exclusively an Applescript problem. Others are reporting that setting the import options doesn't work in JavaScript unless you do what you did, save the file back to .xls.

           

          I couldn't get it to honor the preferences settings when importing from an .xlsx file. It looks like it does set them, as I can ask for the properties of the excel import preferences and it will list back exactly what I told it to set using the code as you have above, but then that apparently gets overridden when it comes to actually pulling the document in to place it.

           

          I'm in CS5.5, BTW. Sounds like this problem has been around for awhile.