Highlighted

Any scripting solutions for syncing Excel data to Illustrator charts

Adobe Community Professional ,
Apr 29, 2020

Copy link to clipboard

Copied

I am mostly an InDesign scripter, but am looking at a project that would include creating charts in Illustrator and linking them to an ID file. The charts would change periodically based on updated values in an Excel file. I have done some research, but I can't believe there's no functionality in Illustrator for syncing the Data field to an Excel file to allow for updating. Is the Data object available through the DOM; could I select a chart, look at its data field and copy over read values from an Excel file? I've poked around the Illustrator DOM, but from what I remember in working with it previously is that not everything is exposed like it is in ID. 

Thanks in advance for any thoughts you might have. 

Topics

Import and export, Scripting, Third party plugins

Views

642

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

Any scripting solutions for syncing Excel data to Illustrator charts

Adobe Community Professional ,
Apr 29, 2020

Copy link to clipboard

Copied

I am mostly an InDesign scripter, but am looking at a project that would include creating charts in Illustrator and linking them to an ID file. The charts would change periodically based on updated values in an Excel file. I have done some research, but I can't believe there's no functionality in Illustrator for syncing the Data field to an Excel file to allow for updating. Is the Data object available through the DOM; could I select a chart, look at its data field and copy over read values from an Excel file? I've poked around the Illustrator DOM, but from what I remember in working with it previously is that not everything is exposed like it is in ID. 

Thanks in advance for any thoughts you might have. 

Topics

Import and export, Scripting, Third party plugins

Views

643

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
Adobe Community Professional ,
Apr 29, 2020

Copy link to clipboard

Copied

It's possible, but not easily. Illustrator's native charts made with the chart tool can be bound to data, but this data has to be an XML format of chart data that Illustrator can work with. Not only that, but this isn't a live link and has to be updated with some extra script functions when data is updated. The XML file can have multiple datasets, but rotating through them in Illustrator's Variables panel will only make one data set displayed per record (or dataset as they call them).

I have made a variable importer script which has a section for graph data, and that's how Adobe made the native csv import button work too, the graph variables have to be tabular data inside of a text file. Then it gets turned into XML and extendscript can then import this XML file and display the data inside the Illustrator chart.

https://github.com/Silly-V/Adobe-Illustrator/blob/master/Variable%20Importer/VariableImporter.jsx

On line 2171 there's a block which turns the text files into XML and it was created to help me with the project by another scripter I've met on this forum years ago.

 

In your case you could make a button or some script to work from Excel by turning a selected area or chart into a .txt file or text string to pass to the Illustrator script which will then turn the data into a variables library to display inside a native chart object. Another problem is if you actually do use this kind of system, it will complicate things when needing to update only one chart in a document with several variable charts. To solve it you may be able to first export the document's variable library with your script and then use string-replacement to splice in just the part created via Excel's update.

I hope this is understandable, let me know if you have any questions!

By the way, I'm going to soon enable the variableimporter to run with arguments - it might help out future projects like yours.

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
Reply
Loading...
Adobe Community Professional ,
Apr 29, 2020

Copy link to clipboard

Copied

That all makes sense. Thanks for sharing your code. I'll investigate and see how it goes. 

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
Reply
Loading...