Skip to main content
Inspiring
February 28, 2023
Question

Is there a way to pull Text from an Excel File via a Script? - Not a Variable Data Process

  • February 28, 2023
  • 2 replies
  • 1759 views

Currently, I have to copy data from an online PDF into an XSLM Exel file. 
Then using a Macro I am able to pull and organize the needed data into a column L15:L32
Last, back in my Illustrator file I have Tethered Text Boxes, the 1st one contains the text "xxxx", I select that and "CTRL+V" to paste in the needed data.

 

Is it possible for a Script to grab the data from the active tab in Excel and do a Find and Replace if that script knows the name and location of the Excel file?

C:\Users\Public\Spec Work.xlsm


Any and all feedback welcome on this 🙂

This topic has been closed for replies.

2 replies

jduncan
Community Expert
Community Expert
February 28, 2023

Can you export the Excel file to CSV? If so, then as long as it's a simple CSV, you can read it into ES like any other file and extract the info you need. It does require the extra step of exporting the file though.

Mylenium
Legend
February 28, 2023

Not really. How would you even do that without being able to control Excel, which uses VBA? The apps just don't talk to each other. You could possibly create a function that fetches the data to the clipboard whenever a table cell is updated in Excel and paste it from there, but that's probably as good as it gets and even that is a super fragile construct. Of course you could also parse the XLSM file, but you'd still need to re-save it every time and parsing through a chunky XML node tree is anything but trivial and won't be fast. There's a ton of extra wrapping in these files, including binary data which you would need to strip/ ignore.

 

Mylenium

Inspiring
February 28, 2023

@Mylenium yeah I knew they didn't really communicate all that well unless the excel file was a simple XML, but wasn't sure if there was a way to "code around" the issue by way of some how some way creating a JSON file or the like.   But I've been amazed at what scripts have been able to accomplish so I thought I would make the ask  🙂

CarlosCanto
Community Expert
Community Expert
March 1, 2023

Since you're on Windows, there are two ways I can think of, both are similar

 

1. an Illustrator vbs script can talk to both Excel and Illustrator

2. a vba script in Excel can talk to Illustrator