I am working with personalized items for different sports teams. We get a spreadsheet of personalizations needed (like "Bob", "Cheryl", "Best Dad") that need to go in a text box on an illustrator document, with a piece of vector artwork specific to that document. For example, we may get an order that has Dallas Cowboys, Seattle Seahawks, and Florida State University, but each team will have a different name based on what the customer has ordered.

Our filenames are usually the league of the team, team name, and item SKU. So for Seattle Seahawks, it would be something like NFL-SSH-ETCHED.pdf. Is there a way to script it or use variables that would recognize the team name or filename, and insert the personalization into the text field? I've worked with variables on ONE document before, but not across multiple documents with such specific requirements.

Kudos in advance! enter image description here

  • 1
    Hi Katie, welcome to GD.SE! Can you explain why you need multiple documents? Generally when you do variable data / data merge, you have 1 working file and a CSV file with the data. The info is imported into your working file and exported as separate PDF's. You would be importing both the artwork and text into a blank document. – AndrewH Sep 8 at 21:16
  • I don't follow completely.. are you wanting the system to determine which file is needed based upon text, then use variable data to update that file with the text? Multiple file management would require scripting at the OS level most likely. But.. symbols in one AI file may allow variables there. Variable for symbol to use, then variable text... – Scott Sep 8 at 21:30
  • @AndrewH Thank you for the warm welcome! For the multiple documents, we might have two customers on an order who want Seahawks, but one wants "Bob" and the other wants "Tom". We already have artwork templates set up with the logo in the correct position, and the logo must be vector in order to be used. I'm assuming then that it would be easier to have one document and just have the logos somewhere for it to pull into a blank document with the associated name? – KatieTMC Sep 9 at 12:12
  • @Scott You pretty much have it! Basically using the filename to determine where to insert the text. We get some really strange personalizations sometimes (no lie, I got "HOTDOGPLAIN" one time), so it might be easier in the end to use symbols to just drop the logo in a blank document like AndrewH stated above. Thank you for your help! – KatieTMC Sep 9 at 12:16
  • No but you can do this in indesign – joojaa Sep 9 at 12:40


I think I was just as confused as @Scott. Now that I re-read the question, or maybe I really read it for the first time and realized my original answer doesn't answer the question. I thought OP wanted the exported files to be named after the teams :/ I might delete this later, but I'll leave it in for now.

I still don't really understand what you want. What confuses me the most is how you say you want a text variable to change based on a filename. Do you mean the logo file? How does that relate to the custom messages in your spreadsheet. Like if "Name here" is replaced with NFL-SSH-ETCHED.pdf, then enjoy your shirt (or whatever), Mr NFL-SSH-ETCHED.pdf ...Sorry your parents named you that.

The image in the post makes me think what you need is a simple csv file with the custom message and another column with a path to the image file, something like they have in this video, but I just can't wrap my head around your explanation.

If I wanted to change a text variable based on filenames, I'd likely copy files to clipboard and paste that to a spreadsheet application. On a mac pasting files to a text editor will just print out absolute paths to the files. Not sure if that works on Windows. Then I'd use find and replace to replace the path portion with nothing and now I have a spreadsheet with just the filenames that I could import to AI (as show in the video).

Original answer:

It might be easier to batch rename the files afterwards.

  1. You could use the Filename (document name) + number config in AI's batch to make sure the output order mirrors the spreadsheet row order.
  2. Then you could use a batch renaming application to rename the files. It just needs to be able to rename files from a list:

How you could do it with Better File Rename

While it does accept csv files as the input, I'm pretty sure it only understands plain text where each filename is in its own line, so you need to make a separate (.csv, .txt) for the renaming with just one column.

I didn't actually export any files from ai, I just made an example csv and forgot to add a header row...

Click to enlarge: enter image description here

| improve this answer | |
  • Sorry it's a bit complicated - I'm having a time trying to wrap my head around it myself! We've been doing this manually for about a year now, and the higher-ups want us to streamline things (2 artists with very minimal programming experience). The filename is usually just for our benefit, since sometimes we'll have an order with 2 or more NFL-SSH on it. So we'll end up with NFL-SSH-ETCHED-BOB or NFL-SSH-ETCHED-TERRY. I'm thinking like AndrewH stated above, the easiest way to keep everything vector is to let it dump symbols and text into a blank document. Then batch rename. Thoughts? – KatieTMC Sep 9 at 12:36
  • What's the spreadsheet like? Mainly I'm curious if it's like (columns): message, team, path to team logo or something. Do you already have a working workflow with variables and it's just the filename you'd like to fix? – Joonas Sep 9 at 12:45
  • Here's an example spreadsheet: link "Item" is for the SKU ordered (the different numbers on the end like 404BPER/404WPER are different product types, 20oz white and black stainless tumblers). We're aiming to insert the Personalization text into the text box in the Illustrator document, and have the document named so we can identify the personalization inside the document. (COL-BOS-404BPER --> Personalization is "KYM" --> insert "KYM" into NAME HERE --> Save document as COL-BOS-404BPER-KYM) – KatieTMC Sep 9 at 13:10
  • I think I would personally go the extra mile an write my own script, because it wouldn't require that much work and that way I could make it pretty much do it all in one button press and it would work with new spreadsheets without any extra work too. — You could do it with variables, but it might not be as automatic as one might want or at least the solution I'm thinking of anyways. The big hurdle is setting up the image file path, because you would have to add it to the spreadsheet manually or semi manually. – Joonas Sep 9 at 20:12
  • But you could perhaps generate that using a formula, by combining the two columns and adding the file extension or whatever... — So ignoring the image path for now, you could use VariableImporter.jsx, because in it you can set custom/dynamic data set names (automatically). This is important for file names, because one of the options in the native batch processing dialog is to set the filename after the data sets. – Joonas Sep 9 at 20:13

I don't know about Illustrator but.. InDesign has a thing called Live Captions which you can research. It basically pulls file names automatically for images in a document and places that as text boxes based on predefined rules. You can then use GREP to process this text information containing file names. I can't be more specific because the question is not very specific and setting this up can be tricky.

| improve this answer | |
  • Thank you for your help! The artwork needs to be vector in the end, unfortunately. It's going to an engraving machine that only accepts PDF vector format files. It's definitely complicated by the fact that customers have 14 characters to type anything they want in... – KatieTMC Sep 9 at 12:20

I think this can be done in both Illustrator and InDesign

First you need to setup each variable in an Excel file. Have the names in 1 column, and the image will be in another column. The image column will use a file path that links to where the graphic is for this person. You need to include "@" at the beginning of the image variable. If you already have a list, you can use a formula to make a file path based on the list provided to you.

Excel data

In Illustrator, start a new document and use File Place to put one of the graphics into the document. Then write your text where you want it.

sample document

Open the Variables panel, Import your csv file. Then select the text and apply that to Variable1. Do the same thing with the image.

Variable Text

Open the Actions panel, and create a new action. Then go to File -> Save As, and save the PDF somewhere. End the action.

Select the completed action, and in the advanced options, select Batch.

Make sure the source is Data Sets, choose export location, Override Action "Save" Commands, and choose "File + Data Set Name". Then Click OK. Each variation will be saved as an individual PDF.

Variable PDFs

TIP: I would make sure each graphic has the same artboard size.

| improve this answer | |

This is not actually a hard problem at all. Its just that your asking is a bit upside down. See what your describing is a automated process hands down a file and you want to leverage another automated process when you open said file, so that you can submit it to some other process.

You could do what you propose its not terribly hard in itself. But illustrator is not a dependency graph or script executor. Its not like a webpage, it has no hooks for putting code into the ai file. So you would have to permanently alter all copies of illustrators that open your files. Its possible but not terribly maintainable and far more headache than you think.

You could do this in indesign but with similarish caveats, but with less alterations. Indesign is totally equal as a vector application so that wouldn't really be a problem. Only one thing to understand is that your deal with adobe says you guarantee you will never use indesign server bound or unatended. Because they are selling indesign server that is just a more expensive indesign that allows you to do this. If you get caught doing this be prepared to pay tens or hunders of thousands or kiss goodbye to all adobe licenses.

Now the easiest way is actually just let the original script make the alteration it isnt really all that hard if you just relinquish the part where you do this once you open the file. Just let the script open the file easy peasy 20 lines of code.

| improve this answer | |

*** I do not work for XMpie, nor do I have any benefit from recommending this, other than as the best solution to help the OP.

If your higher-ups are ok with the cost, probably the easiest way to do this would be to invest in XMpie.

You can use their much more advanced data merge capabilities to write scripting that can pick apart the info in your first column then select the image, and put it in a certain position, add the name, and export.

You can then use that master template to load and export from any CSV fairly quickly once everything is set up. If you get it and post here, I can help you write the script.

If this is what you do all day / everyday, this would be well worth the investment.

| improve this answer | |
  • XMpie definitely looks like it would be useful for our situation, since we will indeed be doing it all day, every day. Thank you so much! I'll pass it up the ladder and pray it sticks :) – KatieTMC Sep 9 at 18:07
  • It's one of those "modular" type programs, so make sure you work with a sales rep to get ONLY what you need for features, and don't over pay. For what you are trying to do, you won't need uChart or uImage as you're just looking to place the logo and then text in Indesign. the uDirect Classic should be all that you need. You can play with a full working trial, it just only outputs a limited number of records with a watermark over them. – Alith7 Sep 9 at 18:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.