0

My script is supposed to create a page in Indesign, then create a text frame on that page, and finally import an Excel spreadsheet into that text frame. It works, except that it will only import the first page of the Excel doc, regardless of how I set the preferences. I've tried it with sheeName and sheetIndex, with no success.

the script:

var doc = app.activeDocument;
var myPage = doc.pages.add();
var myFrame = myPage.textFrames.add();
with (app.excelImportPreferences) 
     {
     sheetIndex = 2; 
     }

var myExcelFile = File.openDialog("Please select an Excel file","*.xlsx");
var myLink = myPage.place( myExcelFile )
PaulTong
  • 35
  • 4
  • By first page, do you mean the first sheet? If there are multiple sheets, you will probably have to loop through them. – Josh Voigts Jul 10 '14 at 21:09
  • @JoshVoigts- Yes, I did mean sheets. Everything I've ever seen about Excel import preferences has no mention of loops, the sheet is specified with either a sheetName = "Sheet Name" or sheetIndex = 2. – PaulTong Jul 11 '14 at 00:26
  • Related to this query: http://stackoverflow.com/questions/24946883/how-to-set-excel-import-preferences-in-indesign-cs6-using-extendscript – belscb Jul 25 '14 at 01:58

0 Answers0