Skip to main content
Skemp_-_ACE
Participant
December 15, 2016
Question

Excel Import Prefs for XLSX not working in CC 2017?

  • December 15, 2016
  • 1 reply
  • 331 views

Hi all, hope someone can help.

I am attempting to convert a script that has been working fine in CS4 to work with CC 2017. However I have discovered that the excelImportPreference do not seem to work for Excel files saved as XLSX but do for XLS files. Is this a known bug and is there a workaround?

In particular, it is the sheetIndex preference I need to set, Users can set the TableFormatting preference in the application itself but the sheetIndex varies.

test script below:

//myImport_Excel = File ("~/Desktop/test.xls") // Working in CS4 and CC 2017

myImport_Excel = File ("~/Desktop/test.xlsx")  //Not Working in CC 2017

var myTextFrame1 = app.activeDocument.pages[0].textFrames.add({geometricBounds: [20, 10, 80, 250]});

with(app.excelImportPreferences) {  

sheetIndex =  0;

TableFormatting = TableFormattingOptions.EXCEL_UNFORMATTED_TABBED_TEXT;  

}     

myTextFrame1.place(myImport_Excel)

Thanks.

This topic has been closed for replies.

1 reply

tpk1982
Legend
December 15, 2016

add this line in top of your code which is working in cs4

app.scriptPreferences.version = "6.0"

It is a temporary solution

Skemp_-_ACE
Participant
December 15, 2016

Hi tpk1982,

Thanks for the reply but sadly this doesn't work.