Automate Photoshop Text and Image Swaps with CSV
Adobe Photoshop allows users to automate repetitive design production by binding layers to external data using its built-in Variables feature. By pairing a Comma-Separated Values (CSV) file with a template document, Photoshop can dynamically substitute copy on text layers and swap visual assets on pixel layers across hundreds of variations. This guide explains how to define layer variables, format your CSV spreadsheet properly, import data sets, and export the generated design files automatically.
1. Set Up the Photoshop Template and Define Variables
Before linking data, you must tell Photoshop which layers will change dynamically.
- Open your base design in Photoshop. Ensure every layer you want to automate is a distinct layer (such as a standard text layer or a pixel/raster layer for images).
- Go to Image > Variables > Define.
- In the dialog, select the layer you want to automate from the Layer dropdown.
- For text layers, check Text Replacement and enter a
unique Name (for example,
ProductTitle). - For image layers, check Pixel Replacement and enter
a unique Name (for example,
ProductImage). - Set the Method for pixel replacement to control how
images scale into the layer bounds:
- Fit: Scales the image to fit entirely within the bounding area while maintaining aspect ratio.
- Fill: Scales the image to cover the entire bounding area, cropping edges if necessary.
- Clip: Keeps original size and clips anything outside the area.
- As Is: Retains the imported image's native dimensions and proportions.
- Repeat this process for all layers requiring dynamic swaps, then click OK.
2. Format the CSV File
Photoshop requires the spreadsheet to match the exact variable names configured in your document.
- Headers: The first row of your CSV must contain the exact variable names you assigned in Photoshop (case-sensitive).
- Text Entries: Enter the text string directly under the appropriate text variable column.
- Image Entries: Under the pixel variable column,
enter the file path to the replacement image (such as
images/item1.jpgor full paths likeC:\Assets\item1.png). If you use relative paths, save the CSV file in the same directory structure relative to the image assets. - Saving: Save the spreadsheet as a standard Comma Separated Values (.csv) file or a Tab-Delimited (.txt) file encoded in UTF-8.
Example layout:
ProductTitle,ProductImage,Price
Running Shoe,assets/shoe.jpg,$120
Hiking Boot,assets/boot.jpg,$180
3. Import Data Sets into Photoshop
Once the template and CSV file are ready, populate the data into Photoshop:
- Navigate to Image > Variables > Data Sets.
- Click the Import... button on the right side.
- Click Select File..., choose your CSV file, and ensure the encoding is set to Automatic or UTF-8.
- Check Use First Column For Data Set Name if you want the generated records named after your first column.
- Click OK.
- Use the Data Set navigation arrows or the preview checkbox to click through records and verify that text changes and images load in their proper positions.
- Click OK to apply the data sets to the document.
4. Export the Generated Files
To create individual output files for every row in your CSV:
- Go to File > Export > Data Sets as Files...
- Choose a destination folder where the output files will be saved.
- Configure the File Naming scheme using presets (such as Data Set Name, Document Name, or sequential numbering).
- Click OK. Photoshop will process each row in the
CSV and output a separate
.psdfile for each data set.
If you need web-ready formats like JPEG or PNG, navigate to File > Scripts > Image Processor, select the folder containing your newly exported PSDs, choose your desired output formats and quality settings, and run the batch conversion.