How to get a cells(i,j) value from an excel file, using scripts.

New Here ,
Apr 23, 2022 Apr 23, 2022

Copy link to clipboard

Copied

Hello,

 

I am looking to get data from excel file via a script to be run from illustrator app and then use this data to set the name of a layer (for example). I tried many scripts on the internet but it didn't work. Here's the script I think very close to the correct one:

 

function readFile(column, row){
var excel=new ActiveXObject("Excel.Application");
var excel_file = excel.Workbooks.Open("C:\Users\Amine\Desktop\My Scripts\Hes.xls");
var excel_sheet = excel_file.Worksheets("Sheet1");
var data = excel_sheet.Cells(column, row).Value;
alert(data);
return data
}

var Needed=excel_sheet.Cells(1, 2).Value

 

(When I run it, it returns : "excel_sheet is undefined")

Could you please help me with any modifications to add or a new script.

 

Thanks

TOPICS
Import and export , Scripting

Views

125

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 23, 2022 Apr 23, 2022

Copy link to clipboard

Copied

LATEST
quote

Here's the script I think very close to the correct one:

By @Amine241660526qdd

 

I'm sorry but that snippet is the opposite of a very close to being correct script.

 

instead of querying an excel file, export the file to csv, read all the data, save it to an array of rows and columns then use the data in illustrator 

 

check this thread for a sample usage

https://community.adobe.com/t5/illustrator/using-spreadsheet-data-to-transform-illustrator-objects/t...

 

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines