Import .csv & .txt files into Adobe Illustrator as datasets, with VariableImporter.jsx
For over a decade, Illustrator has had a variable data feature, allowing users to manufacture a set of documents by using a data file with variable text, images, object visibility states, and graphs (Supported starting in VariableImporter version 8). The problem was that unlike InDesign, which natively imports .CSV and .TXT files, Illustrator only accepted XML files.
Illustrator XML files are much less forgiving than the above-mentioned text formats. They have to follow XML syntax rules, which means, among other things, converting some characters into XML entities such as: "&" ampersand has to become "&"
The design behind using XML to drive dynamic content may have been intended this way to accommodate a web-to-print workflow specifically. It would be easier, in some ways, to create standardized XML files from a database using business-specific software. As Adobe's help site states:
If you’re a developer, you can code variables and data sets directly into an XML file. The designer can then import the variables and data sets into an Illustrator file to create a design based on your specifications.
However, many Illustrator users are actually in need of this feature, but without the dependence on an XML file. This can be now solved with the VariableImporter.jsx script for Adobe Illustrator.
VariableImporter.jsx intelligently parses a tab-delimited (.txt) file or comma-separated (.csv) file to produce a valid, well-formed XML file, which is imported instantly as Illustrator datasets. The process is instantaneous, and the XML file is automatically erased after it is imported. There is also a feature, among others, that lets you keep the resulting XML file so that it can be shared with others.
VariableImporter.jsx supports three variable kinds: text, linked-file, and visibility variables. In conjunction with Illustrator's robust appearance features, a variety of dynamic appearance configurations can be achieved in ways not possible, or practical, in other applications such as InDesign and Photoshop (both of which can import .csv and .txt files natively). Finally, these variable data-driven files can be made with .csv/.txt data on a local workstation.
Benefits of VariableImporter.jsx include:
- visibility and linked-file support
- option to retain the CSV/TXT data as an XML file
- intelligent parsing of paragraphs within a text cell (puts <p> tags around multiple nextline/return-delimited text bodies)
- intelligent parsing of boolean visibility data. (Any characters and no characters are converted to "true" and "false", respectively, if not already "true" or "false")
- Dataset naming feature similar to Photoshop's
- Auto-binding of imported variables to art objects by name, note, or scripting tag (used in scripting only).
- script runs in Illustrator, on a local machine in its entirety
The graphics & print workflow consultant Stephen Marsh has posted a description and tutorial on VariableImporter.jsx on his blog: https://prepression.blogspot.com/2015/03/illustrator-introducing.html
The script can be found in a github repository here: https://github.com/Silly-V/Adobe-Illustrator/blob/master/Variable%20Importer/VariableImporter.jsx
Special thanks to:
- The giants of the Adobe Illustrator Scripting forum for contributing the wealth of information which made the development of this script possible.
- Andy VanWagoner, CSV parsing code
- Stephen Marsh, blog, testing, documentation, feature suggestions
- Hans Boon, testing & industry input
Colour Designer 2 at Arc'teryx Equipment
6 年Hi Vasily, I'm running into issues with the auto binding feature. I have the text fields and image fields (along with th elayer names) named the same as the column headers yet it still is unable to bind. Any thoughts?
Director at AD'communication
8 年Hi Maybe i am using it wrong but how to keep the data up to date. I m changing my excel CSV then save it and i don t see how to update datas from illustrator with the new file saved! Thx
Realtor - Associate Broker at Berkshire Hathaway HomeServices New Mexico Properties
9 年Vasily, how would one go about asking for what seems to be a simple enhancement?
Thank you for creating this. I hope to be able to use it as I figure it out and apply it to my needs.
Art Technologist at GraphXsource
9 年All new in version 7: support for Graph variables!