SUPER-DUPER Update: I’ve completed a 2.5 hour course on how to use the NEW Variable Importer 8.0 script, and it’s available on Lynda.com! Click to check out more info on the Adobe Illustrator Variable Data Lynda.com course!
And now back to our in-progress blog post…
Previously, I wrote up a tutorial for an easier method to use Adobe Illustrator’s Variable Data feature. By easier, I meant easier than the procedure outlined in the official Adobe documentation.
This time, I’m back with an even easier method, if you can believe that. Recently, I was contacted by Vasily Hall, an script/automation expert who has developed a script for Illustrator called Variable Importer.
I go through it fairly quickly in the video above, but read on for a bit more in-depth walkthrough
What Is Variable Importer?
The Variable Importer script enables you to automate many of the previously annoying aspects of the usual methods of importing variable data into Illustrator.
The top issues resolved with the script are:
- XML is generated automatically by the script, allowing you to import a plain old csv file just like InDesign.
- Filepath to images automatically linked by the script. No more hunting down the correct syntax to input a filepath into your csv.
- Variables can be “auto bound” to objects, sparing you yet another annoying step of manual binding
- You can customize Dataset names at import time.
There are many more little niceties within the script, so let’s go ahead and take a look.
Get The Variable Importer Script
First we have to get the script installed in Illustrator. To do this, first go to the VariableImporter script home on GitHub.
Once you get there, click on “VariableImporter.jsx”, then click the “Raw” button (shown in screenshot above). This will bring up a page that contains the raw code of the script. From here just “Save as…” from your browser to download (don’t just right-click the “VariableImporter.jsx” and save, because that way will introduce errors into the script – make sure to only save the “raw” code).
You’ll see another script there, too called “RenameArtFromText.jsx”. If you’re interested in doing multiple data sets up on a sheet then grab this one, as well.
Now place the file in your Illustrator Scripts folder and restart Illustrator (or choose to load it each time using the Other Script command).
On my Mac, the location of the Scripts folder is:
/Applications/Adobe Illustrator CS6/Presets/en_US/Scripts (yours may also be inside a “en_GB” folder or other if you have a different language installed).
On the Windows installs I had access to the path was
\Program Files\Adobe\Adobe Illustrator CS6\Presets\Scripts
You can see I’m using CS6 here, but I’ve tested it in CS5, CC, and CC2014. Plus, I have it on good authority that it works in CS4, too.
Now, once you’ve restarted Illustrator you’ll find the script listed under File > Scripts.
So now we’ll need to prepare our data source, which is our csv file, in order to have some variables to import.
Set Up Your Data Source Csv.
We’ll revisit the “Super Cards” I did in my last tutorial so we can examine the new process with them.
Checking the screenshot of my csv file you can see it looks pretty average. There’s no special tricks needed, and you can use any software that can generate a csv file. I usually use NeoOffice, a more Mac-like version of the OpenOffice software.
A couple of quick observations about the file
- Note that you don’t have to have the first column named “Dataset” anymore. We’ll create the Dataset names at import time now, so we don’t need a special column to hold those names.
- Note underscore the “team_name” column heading. This isn’t special to the Variable Importer script, but just a reminder that you can’t have any spaces or special characters in heading names. Making your heading names here isn’t strictly necessary (you can also create them via the script itself), but it’s just the way I usually do things.
- Note the image column has the “@” symbol in the front of it. This is similar to InDesign, and it’s the way that the Variable Importer script is alerted that this column contains images.
- Note the image column has no file path information. Again, we’re freed from having to go find this information and place it into our csv, because the script is going to input this info for us at import time.
So basically there’s really not much to do here but fill/paste in your information, or clean up the column headers if the csv is provided to you by someone else.
Then it’s time to get into our Illustrator file.
Set up your Illustrator file.
Checking the above screenshot you can see my Super Cards file is back in action.
Everything that I want to be a variable is it’s own separate object. Some things to note here are:
- You can see in the Variables palette that there are no variables set up yet. Adobe’s official docs have you create these up first. This way we can avoid that.
- The objects in the layers palette are named to match the header column of my csv. This will allow the auto-binding feature of the script to work. To change the names, just double-click on the object’s name in the Layers palette and then rename it to match your csv header.
You don’t have to do this, you can always bind the variables after import as shown in my last tutorial, but for this one we’ll use the auto-binding just because I think it’s cool :)
- The image at the top is just a placeholder image that is linked and not embedded into the file.
If your image is already embedded you’ll need to select it, click the “Relink” button on the Links palette, then find your image again, this time making sure that the “Link” checkbox is checked.
If your image doesn’t have that “x” through it when you select it, it’s embedded and not linked.
- Special CS5 note for images: I mentioned last time I had trouble getting images to import using CS5. I’ve had some success overcoming this with this script. My home version of CS5 still doesn’t work, but the CS5 on a few machines I work with on locations work fine. I’m not sure what the issue is with that, but if the error pops up at import time you may have to switch to a different version.
You probably already have your desired file set up, but just make sure to give it the old once-over before you begin.
Run The Variable Importer Script
Ok, time to make the magic happen.
First, go to File > Scripts > VariableImporter then choose your csv file in the window that appears. Once you choose your csv file, you’ll see the below window:
This is the Import Options window, and you’ll see you have quite a few options here (see screenshot).
- The top part of the box is a scrolling frame with all column names listed. Just check through here and make sure all your columns are showing up as intended. If you have a space or special character in your column heading in your csv file then the variable won’t be listed correctly here, and you’ll need to go back and fix it.
- Note that image variables have a colorful, different icon and a Prepend Path checkbox underneath. Checking this box will pop open a dialogue box allowing you to choose the folder where your images are located. It will then prepend that path into the XML file it generates. A huge amount of hassle is solved with this feature. After you choose the folder you’ll see the path filled into the box.
- The next box is the area where you control the Data Set names and name preview. As I mentioned earlier, this feature allowed us to skip using the first column of our csv for the Dataset name as I showed in my last tutorial. Clicking on the “Assign” button will allow you to customize the name of the Datasets using six pulldown menus.
One thing to always remember is that the name of each Dataset must be unique. So if you’re doing business cards and you have two Datasets based on the last name of “Thomas”, then the import will fail because those two names are the same.
That’s why you’ll notice in the Assign Dataset names box that the “Increment” feature is on by default in Field 3. This is enough to spare you from that error, but you can customize further.
If you’d like to use one of the variables in the Dataset name you can do that, too. Just remember to keep the increment field on and it should all work fine.
At the bottom of the window there should be a preview of what your Dataset names will look like. When it all looks good just click the “OK” button. Honestly I skip this most of time in my own work, but if you need those names to be precise, then the script makes it easy.
- Another cool feature of this script is the ability to keep the XML file that it generates. Depending on your workflow, it could be prudent to save this file and keep it as a backup just in case. Again, this isn’t something I use, but I’m betting there will be those who can really make use of this, even if it’s just as an example of what a properly formatted Illustrator XML file should look like.
- At the bottom of the Import Options window is the “auto-binding” feature I mentioned earlier. By default it’s set on “No Auto-Binding”, which means you’ll have to select your text or image object, then select the variable in the Variables palette, and then click the “Make Text Dynamic” or “Make Linked File Dynamic” button at the bottom of the palette.
The other options are:
Bind by Name: With this option, the variable will auto bind if the variable name (column header in your csv) matches the name of your object (which you can find and change in the Layers palette).
Bind by Note: Choosing this option auto-binds the variables of the objects have a note (set in the “Attributes” palette) that matches the name of the column header in your csv.
Bind by Tag: As far as I know, tags aren’t available through the normal Illustrator GUI, but can only be set via script anyway, so most of us can safely ignore this option.
- If you click the “Hamburger” menu at the top right of the Import Options box (to the left of the Question Mark help button) you’ll gain access to a few more settings you can change. Most notable is the Preset Options section. Here you can save and load your settings, which is a huge time saver if you running specific jobs over and over. Or even if you have similar jobs where the same settings will mostly apply.
Another section of vital importance is the “Prepend Path Options” area. This allows you to choose your folder and it will add this path to ALL image variables in your csv. This is huge because otherwise you’d have to select the folder for each image variable in your csv. For 10 images it’s an annoyance, but if you have 20, 30, 50 images it becomes a problem.
Other stuff in this window include the ability to predetermine where you want the XML file to be saved, and checking the top button allows you to pop up a warning if the increment field in the Dataset naming window is removed. Vasily added this at my request because I worked with a couple of people who removed that field and ended up causing their import to fail.
Now, if that field is removed, seeing that quick error will hopefully allow them to fix that before their import is potentially ruined.
To get out of this area click the Hamburger menu button again and it will take you back to the main Import Options window.
- Finally, the “Question Mark” button at the top right has some quick instructions on how to use the script. This is good for giving someone a quick rundown if you were to pass the script on to them.
So once you’ve adjusted all these options to your liking, you just click the “OK” button at the bottom and the import will proceed. If all went well, you’ll get a dialogue pop-up declaring how many records and variable names have been imported.
Check your Records
After this, it will probably look like nothing has changed. This is because Illustrator doesn’t actually select the first record for you, so you have to choose your first record from the Data set dropdown in the Variables palette. Once you choose that first one, the correct information should now be showing in your file. Then you can use the arrows at the top of the Variables palette to quickly cycle through all your sets and make sure they are ok.
At this point all you have to do is export each Data set as it’s own file.
Export all Datasets via action
Now that you have the variables loaded in and working, you’re going to have to output these to separate files at some point. This is accomplished by using an export action. Basically you have to save the file first, record the saving of that file, then play it back so Illustrator can save all the files itself without user input.
If it’s not already open, select “Window > Actions” from the top menu. Select “New Action…” from the right flyout menu, or click the New Action button on the bottom of the Actions palette.
In the window that appears, you can name the action something like “Save EPS” or Save AI” or anything that helps you remember what it does.
Once you click the “Record” button in that window, the action will begin recording. From this point, do a “Save As Copy…”, and then choose your desired format and location. Don’t worry about what you name the file at this point.
It’s important to use “Save As Copy…” because if you simply use “Save As…” then for some reason Illustrator will not save the file extension. This may be fine for some, but the Rips I work with won’t process an image without an extension, so I gotta have it.
Another important note about “Save As Copy…”. In my experience I found you should not change the name of the file when you save it. If you do, then the extension will again be lost, and you’ll have to add it back using Bridge or some other method.
When the file is saved, make sure to click the “Stop” button at the bottom of the Actions palette. You now have a complete action you can use to export all of the datasets. You can delete this file you saved, since you won’t need it anymore.
Use export action in Batch process to export all files.
From here we’ll use the “batch” feature to run the action we just made on every one of the datasets.
To start, open the flyout menu on the Actions palette and choose “Batch…” from all the way at the bottom.
In the window that pops up, make sure your action is chosen in the “Action” dropdown. Set the “Source” to “Data Sets”, and choose the folder you saved to in the “Destination” area .
On the right of the “Destination” area is where I usually set my File Name to use “Data Set name”. You don’t have to use that option, it’s just the one I prefer.
As soon as you click the OK button, Illustrator will begin switching through all the data sets and saving them out according to your action. Depending on the speed of your computer and the number of records this might take several minutes. It will definitely be faster than doing it by hand, though.
At this point you’re essentially finished, you have all your files exported and ready to go. Obviously you should take a quick look at all the files using bridge and make sure no errors jump out at you, but basically it should be all done.
If all you needed were separate files, then mission accomplished. But, if you need to get those files laid out on one big sheet for printing, then you’d have to place them all back into Illustrator and group them by hand. In an upcoming tutorial I’ll talk about placing multiple Data sets up on a page.
Congrats, we just imported variable data – the easy way!
LINK ROUNDUP
Here’s a few quick links for convenience:
- The VariableImporter script home on GitHub
This is the official home for the script, so always go here if you need to update it or grab it for another install of Illustrator.
- In-Depth tutorial on VariableImport by Stephen Marsh of Prepression
I know we just got done with a rather involved tutorial here, but I urge you to head over to Prepression and read Stephen’s detailed write-up of the script.
Where my tutorial walks you through a project, Stephen outlines pretty much every little feature of the script, so make sure you check that out.
- Vasily Hall on LinkedIn
Vasily is the author of this script, and he’s actually available for more script work. So if you need some automation in your workflow or know someone who needs some scripting work you should definitely give him a shout.
THE WRAP UP
So that’s all for this tutorial. I hope this provides a much easier method for working variable data in Illustrator.
Stay tuned for another tutorial I’m working on detailing how to add multiple Data sets to a sheet in a semi-painless manner. (EDIT: You can see this tutorial here: https://www.hypertransitory.com/blog/2016/04/11/adobe_illustrator_variable_data_multiple_datasets/
For a final announcement, earlier I mentioned that version 8 of the Variable Importer is already out. Well, I’ve actually created a video course that walks through all the bells and whistles of using that new script for variable data, and it will be available on Lynda.com very soon IT’S HERE! So those of you interested in checking it out can get more info on the Adobe Illustrator Variable Data Lynda.com course at that link.
With that said, I’m outta here. Leave me a comment or otherwise contact me if you have any questions or issues.
Vasily does it again
What a cool feature of Illustrator and it looks like a much easier way to automate a tedious task.
This is beautiful ! Much easier than the other method that involved having to mess with the xml code. Great job on the written and video tutorials, and thank you Vasily for the script !
Thanks, João!
I think Vasily has started a revolution when it comes to handling variable data in Illustrator lol.
All the best, man!
Thank you so much for the detailed tut! One issue I ran into… I want to use Create Outline on the text data, so I included that in my Action. When that gets run in batch, it creates an outline for the first dataset record, but fails to go any further (the act of Create Outline rasterized the dynamic text, thus breaking the data mapping).
Have you found a workaround?
Actually, thinking about it a few more minutes, I reckon I can just create a new action to create the outline and batch the files a second time – 1st for the data, 2nd for the outlines.
Hey Carrie, glad you figured something out!
I was going to suggest doing something like duplicating the textblock(s)/layer(s) in the action, then outline, then export, but now that I think about it that would likely result in a bunch of extra layers in each file that exported. Plus hiding and deleting layers can get tricky in actions.
Your way is probably the most foolproof to just run that extra action. All the best!
Thanks for your response! Curious – are you still planning the follow-up tut for adding multiple datasets to a sheet? Or for that matter, just adding multiple files to a sheet to prep for printing. I’ve used Illustrator for years, but only in the most basic of ways.
Thanks,
Carrie
Hey Carrie,
I want to do the same, however i’m still confused as to how you made it work out? How do i make it so that I change the variable first then after expand/outline the textvariable and export?
what keeps happening for me is that I do the first step by changing the variable, but it also saves and exports into separate files so i’d have to go back into every single file and outline it…
Hi Rose,
It looks like Carrie just ran all the exported files through another action to outline the text. So to quote Vasily’s comment from below:
“The easiest way to get processed outlined text is to do a “double-trip” and run a batch-action again through your result files with an action that converts text to outlines.
So your step 1 is to export all the documents to get the different doc contents and step 2 is to process the resulting documents from step 1.”
If you wanted to do it all in one shot I think it would have to go something like this:
1. Select all text variables (perhaps with Select > Object > Text Objects)
2. Copy (now all text is on the clipboard)
3. Hide (original variables are now hidden)
4. Paste (duplicates are now on the artboard and are selected)
5. Outline
6. Save as copy
7. Delete (outlined text is now gone)
8. Unhide (original variable text is now visible again)
Then hopefully it would just continue on to the next dataset. I haven’t tried this out yet, but some permutation of this might work.
Thank you so much this variable very helpfull for me. i will bookmark it.
Hi,
Thanks heaps, this was a great tutorial.
I eagerly await the next on “RenameArtFromText.jsx”.
In return, I have a super cool tip on creating interactive illustrator documents. To use as a prototyping tool.
You may wish to share it with your audience.
Hi,
Thanks a lot for your sharing! What a great and detail tutorial.
I also did try the ” easier ” way, but it seems there is bugs of the online .xml convertor, that I always have problems in loading the data in ai (invailds happens all the time when there are more there 30 variable datas)
But it works just perfect with the importer scripts.
I have another question to ask for help.
As I will need to output files to printer, how can I export all the files with all data (fonts) outlined?
Carmen : please see the solution by Carrie Dills.
The easiest way to get processed outlined text is to do a “double-trip” and run a batch-action again through your result files with an action that converts text to outlines.
So your step 1 is to export all the documents to get the different doc contents and step 2 is to process the resulting documents from step 1.
Thanks so much!
Great script and very helpful tutorial.
I am very interested in that other tutorial you mention in the end of your video (how to use multiple datasets on a single page – important for the printing of these individual cards).
Looking forward for it :)
I didn’t find a way for that on the internet. The only hint was here:
https://forums.adobe.com/thread/893332?start=0&tstart=0
It seems someone there posted a url to a video showing hot it works, but it doesn’t load…
Awesome tut! Saves hours of frustration.
I’m with @Herman. Any hints for laying all out on a single page so we can send to print?
Thank you!
Pavel
Thanks so much!
Great script and very helpful tutorial.
Wonderful explaining with the article. You are really good man. Thanks
This is simply AWESOME!!!
Thank you so much for this tutorial and script. Lifesaver!!!
Cheers.
Val.
Did you ever get around to making a tutorial on multiple datasets on a single page? I’ve got a massive project I’m working on and I’d love to not have to save & open 27,000 files.
Sorry man, I’m super late with this. I actually did make this tutorial here: https://www.youtube.com/watch?v=083kc84aSIc
when I try to save the .jsx to my computer it only allows me to save it as a .txt format, how do I get he.jsx? any tips? I’m on a mac.
Is there any limit to how many variables the script can process? I get errors when I try to upload my csv with 1275 variables, but no issue with 999 variables. I’ve also uploaded variables 999-1275 successfully, so I know there isn’t a problem with the column names.
Hmmm…I’m going to contact the developer and see if he knows anything about this. Hopefully it’s not a hard limit and can be easily overcome.
Variable Importer top issue resolved point is good.
& illistrator data variable is awesome.
Thanks
really Thanks…
Hi guy’s and girls,
I need some help, if tryed every thing. i did all what you did the same. and still i can’t find the files.
and i need this project done by tomorrow. i need around 300 files. and it’s not working for me.
i have 2 pictures and 4 text items.
thanks anyway
Hi Jsandee,
can you contact me via my contact form and give me the details via email? I’ll try to help you out.
If it turns out to be any kind of bug or something I’ll update the post and comment back so everyone can see.
Hi guys,
Does anyone know any good ways to get symbols into the text?
Say I have a card game and want to show a symbol of attack whenever I reference it in the text.
“Whenever the Spagetti Monster does damage (attack symbol), the victim becomes *wet*.”
Hi Sig,
as far as I know, Illustrator doesn’t support “inline graphics” like that. It seems like it should, but it doesn’t.
So you’d have to place that in manually after import.
If this is a deal-breaker, you might be able to pull it off with InDesign’s Data Merge feature.
With InDesign, you can place multiple variables *within* a text object, instead of Illustrator’s way of using the entire object itself as a variable.
So you would have “Whenever the Spagetti Monster does damage [[image]], the victim becomes *wet*.”
Since InDesign supports inline graphics, it would just plunk the symbol right in there.
I know most people don’t want to port over their project from Illustrator to InDesign, so it all depends on how much work it is to do it manually. If you’ve got a couple of hundred of these to do, it might be worth it to go back and set it all up in InDesign.
Variable Importer top issue resolved point is good.
& illistrator data variable is awesome.
Thanks
Thanks for sharing .. I am new Adobe Illustrator and no idea about this but I read this post it’s really helpful to me..
thanks so much
Very well presented.Thank you for sharing.
Is there any limit to how many variables the script can process?
Thank you so much for giving such great posts
thank you very much
HI,
I used the script for some time, great work.
But since yesterday I get a error message
error 21 undefined is not an object
line 2684
this.window.uielements ….. .active = false;
Hi Tim,
Which version of the script are you using? And which version/platform of Illustrator?
If you’re still using version 7, try upgrading to version 8 to see if that helps.
Also, I think I’ve seen that error before when there was a space or another character in the csv somewhere there shouldn’t be any data. Try copying and pasting just the data (don’t select the whole spreadsheet, only the cells that have data) into a new spreadsheet file, then see if that fixes it.
If it doesn’t, then use my contact form to reach me via email, then maybe I can see your files to try to repeat the issue.
Hello,
This script and batch saving worked great for me for about a month…and now it doesn’t change the name / number before saving so I end up with 6 of the same thing. It knows that there are 6 “different” names / numbers so it saves it 6 times, but doesn’t change anything before saving. Again, it worked for a month and then just stopped working. I’m on Adobe CC with version 8.1.0 for the VeriableImport.jsx Any help would be very appreciated.
Jordan
Hey Jordan,
when you run the tests in the Variable Importer does it give you any errors at all?
Have you tried changing the File Name saving options in the Batch window at all?
If that doesn’t help please use my contact form to contact me (easier for me to keep track of), then if possible you can send me the files and I’ll take a look.
Ok…for anyone reading this: Me and Jordan conversed and tested via email, and it looks like the cause of the problem there was he was trying to bind to the LAYERS, and not to the OBJECTS, which are contained in the Layers.
So if it seems like things aren’t binding correctly or the objects are not being found, make sure to check that you didn’t name the Layer by mistake – especially those of you who use sublayers.
Hi JG,
I have the same problem as Tim, I am using the latest version of the script (by the way amazing work), suddenly today I couldn’t use it anymore.
The message that appears is:
“error 21 undefined is not an object
line 2684
this.window.UIElements[“list_warnings”].active = false;
I tried restarting Illustrator and with a new different document, but it seems it fails as soon as I run the script.
Hopefully there is something I can do.
Thanks
Hey Diego, wish I could take credit for this awesome script, but alas, it was Vasily, and not me who made it :) -I’ll pass along the compliment, though!
As for the error, are you using Mac or Windows? And what version of Illustrator. I was running tests on my Mac but I could never repeat the error myself. Also, does version 7 work for you? Or are they both hosed?
I forwarded Tim’s error to Vasily and he’s already working on it. Hopefully, he is able to get a handle on it. This seems kind of an out of the blue error that doesn’t happen often so it’s hard to diagnose without much to go on.
I’ll post back here when I have updates.
Hi JG,
First of all great script and very helpful tutorial.
Is there any limit to how many variables the script can process?
It’s impossible load my csv with 18 variables, but no issue with 12 variables.
Any idea?
Thanks in advance.
Regards
Hi Jonay,
is it possible for you to send me your files so I could take a look myself?
As it happens, I’m working on a method of reducing the amount of work the script has to do, and maybe it could help out here. I’ll be coming out with a new video soon, but for now please contact me through my contact form and then hopefully we can work out how to get the files to me (assuming you’re allowed to do so).
For anyone reading this, Jonay’s situation was not actually caused by having too many variables, but instead there was data of some form outside of the columns of his Excel file.
For example, he had 18 columns, so columns A-R had headers and data in them. The problem arose because there was data in column “S”, which had no header.
I couldn’t tell what it was, so it may have been a non-printing character or even a space, but the Variable Importer was failing because it couldn’t resolve the issue in this case.
Jonay solved it by simply adding a header to column “S”, and then everything behaved normally. I was able to solve it by clearing the contents of column S, and also by just outright deleting column S.
In a case where you don’t know where the extra character is (if it’s way out in cell AZ1 or something), you would just copy only the specific cells of your data, then paste it into a new document. That way you can be sure only the data you want is in there.
Hi John,
Thank you for sharing this script. I have tried everything but cannot get it to work. I have Illustrator CS4 and every time I try to use the script I get this message: Script Alert “Sorry, the file ‘” + decodeURI(xmlDest) + “‘ could not be saved.” What am I doing wrong?
Thanks,
Lizzie
Hi Lizzie. are you sure you downloaded the file the right way? When you get over to GitHub you have to make sure to click the “Raw” button, then save the raw code that’s dumped into your browser window, making sure to save it with the “.jsx” extension.
If you’re on the Mac, sometimes the Finder tries to help you by adding “.txt” to the end of the file, and then hiding it. If you do a ‘Get Info’ on the script file then you would see the hidden extension there, and you can remove it.
I suspect one of these things is happening. Let me know if any of this helps.
Thanks so much for getting back to me. Yes, I saved it the raw way and by copying and pasting into notepad with the .jsx extension. It never worked. But the problem could be that my Illustrator .exe file is not saved in the default location so maybe the program could not find the right file paths (?). I also have Illustrator CS6 on another computer. So I used the same script files with CS6 and it works like a dream. Thank you so much for sharing this script and the tutorial. It literally is life-changing for my workload!
Best,
Lizzie
Excellent tutorial. Thanks!