Script for Adobe InDesign
Latest update 9/27/2021, version 1.7
Reads a spreadsheet of image file names and text for each, places the images, and inserts the text. Designed to automate the completion of “headshot” layouts of people's portraits and their names, and optionally title or academic degree earned, etc.
- 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 second component is a spreadsheet of file names and text saved as Comma Separated Values (CSV format). The script reads the CSV and imports the images and text into InDesign. 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 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. 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 a consistent matrix that maintains the relative position from image to text for each pair of image/text frames.
Below is an example layout of empty frames ready for the script. (The example is only showing a portion of the page; the entire layout is 180 pairs of images and text):
Below is the result after running the script. The example uses mock images and text to confirm the right text is with the right image.
The example document above is available to download, to try the script and better understand how it works before using it on live work. See the download button below.
Below is a view of the spreadsheet data used to process the example job. This CSV data file is also included in the download of the example document. In actual use, each row is a real name, or other information, plus the file name of the image that belongs with the text.
How to use the script
The interface has three sections: Layers, Data file (CSV), and Images folder. Set the layers, data file, columns to use, and the images folder, then click the OK button to begin. A progress bar is displayed while processing.
Section 1: Layers
Images — the layer on which the empty image frames appear.
Text — the layer on which the empty text frames appear.
Section 2: Data file (CSV)
File — select the CSV data file, a spreadsheet of at least two columns and any number of rows. The minimum columns are one for image file name, and another for the text associated with it. For example, file name for a person's portrait, and text of the person's name and other details, such as title or college degree earned, etc. There is no harm in extra columns. Which columns are the file names, and which are text, are chosen next.
Column image — the header of the column containing the image file names. The file name does not need the full path, only the file name. The choice in Section 3: Images folder is the path to which each file name is added to arrive at the actual location of the desired image file.
Column text — the header of the column containing the associated text. 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.
Section 3: Images folder
Folder — select the folder where the images listed in the CSV data are located.
The script provides user-configurable localization. By default the script language is US English, which does not require further download or configuration. For other languages, download the Language Pack and copy the i18n file for the desired language to the script folder alongside the script file. When launched, the script detects the i18n file and the interface displays the language. If the desired language is not present in the language pack, edit the English i18n file to translate to the desired language, and copy the edited i18n file to the script folder alongside the script file. For details of how to edit and install i18n files, read 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.
IMPORTANT: by downloading the script you agree that the software is provided without any warranty, express or implied. USE AT YOUR OWN RISK. Always make backups of important data.