Script for Adobe InDesign
Latest update 6/15/2022, version 3.4
Reads a spreadsheet of image file names and text for each, places the images, and inserts the text. The original idea of the script was to automate “headshot” layouts. A grid of people’s portraits and their names, and optionally title or academic degree earned, etc. But the layout doesn't have to be people. The images could be anything. Houses, cars, apparel, anything.
- Automate placing images and text
- Keep text with relevant image
- User-configurable localization
Before using the script
The script requires a document is created beforehand. The document is a template, a layout of empty image frames and empty text frames arranged as desired, each on separate layers. The order of layers is not important, and there is no harm in extra layers. Which layer is images, and which is text, are selected in the script interface.
Text does not have to be below the image. It can be above or to one side. The only requirement is the image and text frames form two consistently spaced grids of an equal number of image and text frames. Text frames should have a paragraph style assigned to aid formatting. Also consider setting text frames to auto-size height, to avoid overset text if multiple lines are used. An object style assigned to the image frames can be helpful as well.
The second requirement is a spreadsheet of file names and text, saved as Comma Separated Values (CSV format). The spreadsheet must have at least two columns, one for image file name, and another for the associated text.
The first row is the header, which identifies the contents of each column. In this example, the column for text is labeled Name, and the column for image is labeled Photo. Each row contains a person’s name in the first column, and the file name of the person’s portrait in the second column. These columns could just as well be labeled “text” and “image,” or any other desired labels. The precise column labels, or their order, are not important, and there is no harm in extra columns. Which column is the file names, and which is the text, are selected in the script interface.
The text column may include other details such as title, department, or college degree earned, etc. For multiple lines, insert forced lines breaks in the cell data where desired. In Excel, for example, use Alt-Enter to insert a forced line break.
Image file names do not need the full path, only the file name. In the script interface, the folder where images are located is selected, and its path is added to arrive at the actual location of each image.
The example uses mock images and text to confirm the correct text is with the correct image. In actual use, each row is a real name, or other information, and the image file name that goes with the text.
Below is an example result after running the script.
Example files are available to download, to try the script and better understand how it works before using it in actual production. See the download button below.
How to use the script
The interface has three sections: Layers, Data file, and Images folder. Set the layers, data file, columns to use, and the images folder, then click the OK button to begin. The script looks at all image frames on the selected layer, then all text frames on the selected layer. Both image and text frames are sorted by page, then by position starting from the top left, across to the right, then the next row down, etc. Then the images and text are placed into the layout. A progress bar is displayed while processing.
Section 1: Layers
Images — select the layer on which empty image frames appear.
Text — select the layer on which empty text frames appear.
Section 2: Data file (CSV)
Delimiter — the character that separates columns of the data file. The default is comma, normal in the United States. Some European countries use semicolon rather than comma. Select the delimiter relevant to your region of the world.
File — select the CSV data file, then the column drop-down lists (next) are loaded with the columns discovered in the data.
Column image — select the column of image file names.
Column text — select the column of text that goes with each image.
Section 3: Images folder
Folder — select the folder where the images listed in the CSV data are located.
By default the script language is US English, which does not require further download or configuration. To have the script interface display other languages, choose from the available languages below. Download and copy the .i18n file to the script folder alongside the script. When launched, the script detects the language file and displays interface text in that language. If your language is not listed, download the English file and translate it. The file is plain text formatted as JSON, containing interface text in English, and a second value for its translation, which for the English file is the identical text. Copy the file and rename it to replace “en” with the relevant code for your language, then edit the file to change each line’s second value to the translation in your language. For more detailed instructions of how to edit and install i18n files, see How to Localize Scripts.
License details included in download
For help installing scripts, see How to Install and Use Scripts in Adobe Creative Cloud Applications.
Also available for hire to program custom solutions. Contact William for more information.
IMPORTANT: by downloading any of the scripts on this page you agree that the software is provided without any warranty, express or implied. USE AT YOUR OWN RISK. Always make backups of important data.