How to use spreadsheets and InDesign to generate hundreds of cards (or tiles) for your game.
This isn’t a beginner’s tutorial on InDesign, you should be familiar on how to use basic tools like text box, creating shapes and placing images. I will go over the Data Merge feature and in the end will also show some powerful uses of the Find/Change tool with GREP.
What is Data Merge?
With the Data Merge panel in InDesign, you can easily create multiple variations of your document by merging a data source file (CSV or TXT file from a spreadsheet) with an InDesign document. This allows you to create hundreds of variations based on a template, like a card! You can also use it to create tiles or other elements.
An example of what it can do
This is a row from the spreadsheet containing all the information of all cards in Ambal Tournament. It has 12 columns, and each one represents a piece of data that will be populated on the card.
So if you have 100 rows of data, it will generate 100 cards.
Then the data from one row goes into a template created on InDesign and it builds the card.
Notice there are two types of data, text or images.
Let’s go over the details on how to do that
1. Preparing the spreadsheet
First of all you should determine which data will be needed for your card and create one column for each piece of data. Images also count as data.
About Field Names (the top row)
- The top row of a spreadsheet should contain the field names that you’ll use in the target document, such as “SKILL_NAME” and “DESCRIPTION”.
- You can’t have spaces in the field names.
- You should add a @ as the first character of a field name that will handle images.
- Try keeping the field name short.
- Field names are used in the template you will create in InDesign, and will be replaced by the actual data to create the card.
About the Fields (each cell below the Field Name)
- This is where you enter the data for each card, and the whole row is a record that contains the complete set of information for one card.
- You can’t use line breaks in fields. If you need to add a line break you can do so after the document has been merged.
- Some fields can be empty if you won’t use that data in a specific card. For example, in Ambal Tournament most cards don’t have a duration, so I leave the duration field empty for those.
- To use an image you have to input the path to the folder where the image is, plus the image name (example C:\Game_Images\Art\background.png). This is a great way to add different borders and card illustrations without having to place them one by one.
- Images can be layered on top of each other, but make sure to use PNG files with transparent background.
- You can’t save text format (like font, size, or bold) with data source files (CSV or TXT), that will be solved inside InDesign.
- There are some tricks to make specific words bold or replace a word with an image, I’ll cover that at the end.
When you are done with the spreadsheet
Save the data source file, your spreadsheet, as a comma-delimited (.csv), tab-delimited (.txt), or semicolon-delimited text file. I suggest using .csv and placing the saved file in the same folder as your InDesign project.
2. Creating the Target Document (InDesign file)
Create an InDesign document with the size of your card or tile, with the desired bleed and margin (important for printing!). I personally call this doc a template.
Select the data source file using the Data Merge window (Window > Utilities > Data Merge).There is a button that looks like 3 parallel lines, the option to select the file is there.
Once you select the data source file, all the Field Names will appear in the window (like above). Now you need to create the template. I recommend creating the card layout on Photoshop or similar software, then pasting the layout in InDesign so you can build the template on top of that.
To create the template you need to place text boxes for the text fields, and rectangles for the image fields. As the image below shows, I have 7 text fields (red) and 5 image fields (green).
When the text box is placed, click on the desired field name from the Data Merge list you want to place on that location, this will fill the box with the field name (like <<SKILL_NAME>>). Each text box should have the Field Name text.
It is OK if the name doesn’t fit in the box you created, like on the top left corner of my template. That spot will have a single digit number, so that box size is enough. You will be able to double check that with the Preview tool located at the bottom of the Data Merge window.
Choose the right font and text size you want to use in each text box (they can be different) using the Character (ctrl+T) and Paragraph (ctrl+alt+T) windows.
Make sure the images are placed in the right order in the Layers window. If you want an image at the background, place it at the bottom of the Layers list.
Once every text and image fields have been placed and assigned, you will notice that they will have a number on the right side of the Data Merge window. That means how many times that field name is being used (all of them should have at least a 1). You can place the same name field in multiple locations if you want.
Go ahead and hit the Preview button. You should see all of the data from the first entry (second row of your spreadsheet) in the template. You can keep tweaking things in the Preview mode! Use the arrows on the right side of Preview to check other cards or tiles.
When you’re happy with the template you created you are ready to merge everything to create your cards! InDesign will create a new document and each page will contain one entry.
3. Merging the data
You have two options here: export to PDF if there are no changes needed or “Create Merged Document…”. I prefer the second option, it allows you to make further changes on each individual card if you want.
NOTE: Make sure to stop the Preview before merging, it can cause issues with some versions of InDesign.
Creating a merged document will give you access to all of the cards in a new InDesign document. This is where I set keywords to bold, add icons on skill descriptions or add line breaks.
(Below are additional steps to further tweak your cards, but are not part of the Data Merge feature)
The safe way to make keywords bold using the Find/Change query
Sometimes you want to make certain words bold, but other words with the same spelling not bold. Searching for a word like “Mastery” to make them all bold might be bad, since it would also change words found on the skill name or type when you only want to affect the description. It is also troublesome to search each word you want to make bold, and their plurals.
So I decided to add a code, on the spreadsheet, before each word I want to make bold: [b] (without a space between the code and the word). With the Search function you can find any word that starts with [b] and make that word bold, then you remove the [b] code with another search. Two steps.
This is the Find/Change window (ctrl+F). You can create a Query and save it (circled in red) for future uses.
Entering (?i)(\[b\])\S+[\l\u|\d] in the Find what field will make the query find any words with the [b] code. Then you go to Change Format and select Bold under Basic Character Formats.
Once you’re done, click Change All and every word with [b] should become bold. Now you need to remove the [b] with another query.
Just enter \[b\] in Find what and leave everything else empty. Click Change all and the [b] will be gone!
Remember to save those queries, they will save you a lot of time.
Replacing text with images/symbols
We will also use the Find/Change tool for this.
In Find what, enter the word you want to replace between \b( )\b. Like \b(offensive)\b
This is case sensitive, so you can enter other words separated by a vertical bar | . You could also use the code technique from above if you want.
In Change to, just enter ~c. This means that it will change the text to whatever is copied on your clipboard, with ctrl+C. So select the image you want to introduce and copy it with ctrl+C, then hit the Change All button! Every word should be replaced with that image now.
In the example above I selected the sword symbol (circled in red) and ctrl+C it, then added
\b(offensive|Offensive)\b to the Find what field. This will make any “offensive” or “Offensive” words in the document to be replaced with the sword icon.
Conclusion
Once you’re done with the Merged Document, just go to File>Export and select the desired settings.
This might seem like a lot of work to set up, but once you have the template ready making a whole new set of cards is a breeze! This automates a lot of work and reduces the chances of human error.
For further details on how these tools work check Adobe’s guide.
Adobe’s Data Merge guide: https://helpx.adobe.com/indesign/using/data-merge.html
Adobe’s Find/Change guide: https://helpx.adobe.com/indesign/using/find-change.html
Let me know if you have any questions or suggestions! I’ll update this doc and hopefully it will be helpful to more people.