Skip to main content
Inspiring
July 21, 2020
Answered

Develop a script to extract specific data from Excel.

  • July 21, 2020
  • 3 replies
  • 1264 views

Greeting!

 

This community was a big help for the indesign project that I'm working on, Thanks a lot all! I'm facing now an issues and since I'm a developer not a desginer so I'm struggling. Anyhow, the problem is that the datamerge tool isn't working for the designers so they want a specifc items from excel sheet to be selected in assigned to any rectangle. However, I've manged to read the data from excel sheet but I didn't find any sources that describe how can I select a specific column and maniplate it. While using this method ,place( myExcelFile), all the excel sheet data are placed in one rectangle.

 

 

let me describe the case; 

The designers want to create a 6 rectangles and in each rectangle their will be insid it a bunch of items (2 or 3). Anyhow, the items going to be selected from the excel sheet. It's time consuming from them and I'm trying to help them.

 

I'm using Javascript. 

I hope there is any idea how can i catch specific data from the excel. 

 

 

This topic has been closed for replies.
Correct answer Kasyan Servetsky

Otherwise, you can reference the placed table like so:

myPlacedFile.tables[0].rows[1].cells[0].texts[0].contents;

or:

myPlacedFile.tables[0].cells.item("0:1").texts[0].contents;

The .texts[0] part deals with the possibility of overset text. Remember though that the .contents property of any text object is a JavaScript string that does not have formatting.

3 replies

Kasyan Servetsky
Kasyan ServetskyCorrect answer
Legend
July 21, 2020

Otherwise, you can reference the placed table like so:

myPlacedFile.tables[0].rows[1].cells[0].texts[0].contents;

or:

myPlacedFile.tables[0].cells.item("0:1").texts[0].contents;

The .texts[0] part deals with the possibility of overset text. Remember though that the .contents property of any text object is a JavaScript string that does not have formatting.

Participant
February 11, 2024

Dear Sir,

 

I am working as a designer but I am facing long time and mistakes for copy paste text from excel to indesign

Could you guide me to write a script for below

After paste the copied text in indesign I want to change font name, style and size for every line have different font name, style and size.

after this I want to line break of these lines into one line.

Please guide.

 

 

Kasyan Servetsky
Legend
July 21, 2020

If you don't need to keep formatting, you can use this function which worked well for me in a few projects.

To reference objects (rectangle, text frames, etc.) by script, I label them manually (only once) and save the doc as a template (indt-file).

— Kas

Inspiring
July 22, 2020

Thank you verymuch, I've seen your post and tried but it didn't work for me 😞 but i appreciate it thanks.

Derek Cross
Community Expert
Community Expert
July 21, 2020

Have a word with Kris at https://www.rorohiko.com/wordpress/custom-development/

He's friendly and I'm sure he'll be able to do what you want (if it's possible), for a fee of course!

Inspiring
July 22, 2020

thanks for sharing that