Recently I had the mission of creating all atendee badges for the NordicAPIs conference. It involved putting in information (name, company, twitter handle) of every attendee into an illustrator file. Not fun. I vaguely remembered having read about a way to input data into illustrator using XML, but I had never really used it.

Google pointed me to this tutorial by Cheryl Graham where she explained the basics, but I had problem after problem trying to convert my data to an XML format that Illustrator would understand. Since apparently I’m not the only one that has torn her hair out trying to make this work, I decided to write down what worked for me, so that others keep their full hairdos. I’ll assume you have your data in a format such as Excel or CSV (comma separated values), and we’ll use an illustrator script to turn it into XML for Illustrator to use.

Attendees-5406649434.numbers-2NordicAPIs is using EventBrite to manage their ticket sales, and you are able to easily export all attendee information from their site. I exported as a .csv file, though I suppose an .xls file would have done just as well. I opened it up in a spreadsheet editor (in my case Numbers, but Excel works too.). In there I cleaned up the data: I arranged the attendees alphabetically and I deleted all the columns that I did not need for the badges. It is important to leave the headings on each columns, as those will be the variable names for illustrator. Leave or add an extra column in the first place that will be the name of each data set.  A data set is each individual group of variables associated with, in this case, one attendee. For example, if my data set is Name, Twittername, Company, I will add a column before Name with either simple numbers (1-120), or I will duplicate the Name column and rename the header to something like dataset. If you don’t do this, the first column will be used as the name of each dataset, and you won’t be able to use it as a variable.

When your data is formatted and sorted as you want it to be, export it as a CSV file.

Update

There is now an improved script for importing variables from a csv file. You can find it here:

Variable Importer

I’ll update instructions when time allows.

For the next step, you need to download an illustrator script called JET_VariablesFTROU (that’s Variables For The Rest OF Us). If you read “script” and your brain froze in panic thinking “But I’m not a programmer! I don’t know code!”, don’t worry. All we’re gonna do is find and replace one little thing and then illustrator will take care of the rest.

Unzip the file you downloaded and extract the .js file to any temporary location. Then open it up with your favorite code/text editor (notepad, textEdit, dreamweaver…). Look for line #3. It says:

var tabChar=" ";

Change it so it says

var tabChar=",";

Save it.

scriptNow open up Illustrator. Create a new document. In it, make an empty text field. Open up your variables csv document in a text editor, select all the text and copy it. Paste it into the text field in your illustrator document. You should just have a list of comma separated values. Select the text field. Now go to File >Scripts>Other Script and find the JET_VariablesFTROU.js that you saved and edited. It will take a while to process the variables, meanwhile you will see another text field with changing text. When things stop changing, go to View>Variables. You should be able to see your variables and go through each dataset using the dropdown on top of the pallette. On the palette menu, you can select “Save Variable Library”, and then be able to use your data in your file.

Do you want to know how to set up a file to use the XML variables we just created? I’ll leave the explanation to Cheryl’s Tutorial.

Here is the full documentation of JET_VariablesFTROU

 

20 comments on “Converting XML variables for illustrator

  1. Michael on

    I follow along until the end and when I load the script, I see an error message about Line 3 that reads:

    Error 8: Syntax error.
    Line 3
    -> var tabChar=”,”;

    I’ve tried changing it back to tab separated in both the js file and what I copy and paste into the text area in Illustrator with no luck. The error message just changes to replace the “,” with ” “.

    Thoughts?

    • kemie on

      What character is your file using for separating the variables? Can you post your file somewhere so I can take a look?

      • Moya on

        I used a pipe “|”.
        for: pipe "|" separated values, in the JET_VariablesFTROU.js, change it so it says
        var tabChar="|";

        this is an example of my csv

        Dataset|Name|Address
        Dane Smiths|Dane Smiths|429 Charles St #14, Bridgeport, CT 06606
        Gail John|Gail John|1768 Monroe St #9b, Evanston, IL 60202
        Amanda Gavin|Amanda Gavin|5313 N Taft Ave, Bridgeport, CT 06604

  2. beangirl on

    O.M.G. You guys have saved my life! Ok fine. You’ve saved my hairdo at least. I was almost literally ripping it out trying to get this whole process to work. Kemie (and Moya), thank you!

    • kemie on

      I know! I went through the hair ripping myself, so I wrote this post to save the hair of the world! ;)

  3. Claire on

    This tutorial is the closest I have gotten to imputing all my data variables into illustrator. I am STILL pulling out my hair, I get the Error 8: Syntax error line 3 as well.
    I tried changing to the pipe and I still receive an error. I am using a Mac and desperately need help. HELP

    • Dave on

      I was having the same problem and then found the cause. You need to make sure that the quotes surrounding the comma are straight quotes. They can not be open and closed quotes as these are read as a different symbol. Also, if you want to use tab delimitated text use \t for the tab. Once I made the adjustment the script has been working great for me.

  4. DiamondJack on

    I try to use your script, but have such an error:
    ————————-
    Error 21: undefined is not an object
    Line: 5
    var -> paraCount=sourceText.paragraphs.length;
    —————————
    Windows 7 64-bit, Illustrator CS6

  5. Joanna on

    Anyone figure out this Error 21 business yet? This worked wonderfully for me 2 weeks ago and now all of a sudden I’m having the same problem mentioned above.

  6. Joanna on

    AH. I just figured it out. If you get this error it is because the items in the 1st ROW of your .csv file contain spaces – make all your variable names one word with NO spaces and it should work :)

  7. some designer on

    kemie, thanks a lot. really. it works and it was a big, big helper.

    how dumm is the programming of adobe that you have to come so excel files can be imporet. adobe without thouse extra users like you who create scripts because the software is full of bugs and crap , adobe would be nothing.

    if can give also one advise. i clicked in on excel table an actually i dont wrote anything but when i exported the .csv excel generated an extra “,” on the end. so this caused also import problems when running the script.

    after i figured this out it was going well.

    have a great time kemie and keep going…

    • kemie on

      You’re welcome- although I have to clarify that I didn’t write the script. I just found it and thought I’d write this post to make it easier for other people to find & use it :).

  8. Mauro on

    Hola Kemie! thank you for this post.
    Do you know any way to convert from AI XML to excel and then back to AI XML?

    I have a file with 90 illustrations that need to be translated in several languages. So I need to pass all the texts to the translators and then to load back the texts in illustrator.
    The problem is that working directly on the XML file is definitely uncomfortable for the translators.
    Do you have any idea?

Comments are closed.