Copy link to clipboard
Copied
Hi,
We can read TXT and CSV file using InDesign Javascript. Can we read XL file using javascript?
Copy link to clipboard
Copied
I suppose you are talking about excel files, if so then Kasyan Servetsky has a script that does that. Have a look at the following
-Manan
Copy link to clipboard
Copied
Thank you..
Read xl using applescript. is it possible using only javascript?
Copy link to clipboard
Copied
i don't think so unless you know the file format of excel file. These scripts leverage the capability of OS to read these files and hence are using VB/Applescript to read the file. If you want to write something in pure Javascript you would need to know the internals of Excel format to proceed. Basically excel files are an archive of xml files so if you are interested you can explore it, have a look at the following link to explore further if interested
https://professor-excel.com/xml-zip-excel-file-structure/
-Manan
Copy link to clipboard
Copied
Thank you for the information..
I wanted to read XL file. I read applescript but don't know how to read in InDesign Javascript. I wanted to know is there is any possibilities to read it in javascript. Thanks for your information. I will check.
Copy link to clipboard
Copied
I haved checked that code given in the below url
Its returning the number like floating. ie., XL data is 1 but it returns 2.0. similarly 13 digits numbers (isbn) are returns something different like floating number with +E (ie., 8.987654325678+E). How can i get the value placed in xl?
Copy link to clipboard
Copied
I have not tested the code myself but i doubt that it will falter at reading simple number values, lots of folks on the forum have been using this script and quite a bit of discussion has gone around this piece of code. Is the behaviour the same with all the excel files? Are you using the MAC or WIN version of the script? Did you test on both the platforms i.e. MAC and WIN, what is the behaviour. Maybe the creator of the script has some ready insights into what might be causing the issue at your end, i am tagging him Kasyan Servetsky, hope that he has some time at hand to look into your issue.
-Manan
Copy link to clipboard
Copied
https://forums.adobe.com/people/Sudha+K wrote
I haved checked that code given in the below url
Its returning the number like floating. ie., XL data is 1 but it returns 2.0. similarly 13 digits numbers (isbn) are returns something different like floating number with +E (ie., 8.987654325678+E). How can i get the value placed in xl?
Hi Sudha,
if something like this will happen also test if it will happen when using InDesign's UI with placing an Excel file.
I suspect that the formatting of the cells in the Excel file is the cause of that issue. Change the formatting to plain text should help. And strip off all formulas.
Regards,
Uwe
Copy link to clipboard
Copied
Hi,
Thank you for your replies... Thank you..
I have tested in MAC only. I did not set any formulas. I have created the xl as you said. see my screenshot below.
1st column is formatted as text (1st row is formatted with text and placed the cursor in text and gave enter & 2nd one is just formatted as text for the 12 digits number). I ran the script and getting the below out put of the row data.
I don't know how to get the data as it is in xl file (ie, display text in xl).
So i have used Number(column1Val). its returning 239876543212. Similary i used number for column 3 also. Don't know whether this is correct way or not?
Copy link to clipboard
Copied
Precede every number value in your excel with a single quote that will format that number into text and then the script seems to work fine without converting the number into scientific format and neither displaying a decimal. Try the file that works fine for me
The results that i get from this excel are shown below
-Manan
Copy link to clipboard
Copied
Ok thank you.. i will check and get back.