Text Update From CSV

Script for Adobe Photoshop
Latest update 8/25/2022, version 1.1

The script reads CSV spreadsheet rows for layer names and text, and updates matching layers in a master document, then saves new images of each result.

  • Update text layers with new content
  • Multiple text layers each with own content
  • Save a unique image for each row of CSV
  • Output JPG, PNG, TIF, or PSD
Download
Text Update From CSV

FREE to download
Please make a contribution

Many scripts are free to download thanks to the support of users. Help me keep developing new scripts by supporting my work. Click the button to make a contribution of any amount. Thank you.

How-to Video

Before using the script

Using the script requires some preparation.

First is a master image that has text layers with specific names that will be referenced in the spreadsheet data.

The master image requires at least one text layer. There may be additional text layers that are also updated, and there may be other layers or layer groups, of anything to include with all images output.

If the text content might span multiple lines, use a text area rather than single line to define the placeholder content of each text layer in the master image. More about the reason for this is explained in the section How text is positioned.

The second item to prepare is a spreadsheet of the layer names and text content, saved as Comma Separated Values (CSV format).

Text Update From CSV example data

The spreadsheet must have at least three columns, one for “file name” (name given to each file saved), a second column for “layer” (name of the text layer to update), and a third column for “text”, the content to put into the layer. For additional text layers, add another two columns, again “layer” and “text” for the next layer’s name and content. Repeat another two columns for every layer to update. The script does not impose a limit on the number of text layers possible. The number is limited only by how many layers Photoshop can handle given the available computer resources. Any layer name in the data that does not exist in the master image is ignored. Likewise, any layers in the master image that are not listed in the data are also ignored, but their content is included with each image output.

Each row of the spreadsheet results in a copy of the master image saved with the specified text layers updated to their specified text, and named by the value in the column file name. This is the base name (name without extension). The Format option (described in the next section) determines which extension the script adds to the base name.

Text Update From CSV example result
Example result
Dialog vector created by freepik - www.freepik.com

How to use the script

With the master image open, and CSV ready, run the script.

The interface has two sections: Data file and Output. Select the CSV file and the output folder. Enable the desired options, and click the OK button to begin. A progress bar is displayed as images are prepared and output.

For each image processed, each text layer name that matches a spreadsheet column layer has its content updated to the following text column value. The layer itself is not replaced, only the contents, to preserve any effects applied to the placeholder text.

Section 1: 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 used in your region of the world.

File — select the CSV data file.

Section 2: Output

Folder — select the location to which images are output.

Format — select the file format to output. Choices are JPG, PNG, PSD, or TIF.

Convert to profile — converts color to the selected profile prior to output. Note that PNG format is always converted to sRGB web standard, and the option to select otherwise is disabled.

TIP: Converting to another profile is primarily to make CMYK separations for print, which of course is functionality the script provides. But as well, this option can convert duotones to RGB or CMYK, or convert these and other color spaces to grayscale (use the profile Dot Gain 20%).

Flatten — result is a single “Background” layer. JPG always performs this step.

Quality — applies to JPEG images. Valid range is from 0 to 12. 0 is extreme compression resulting in low quality. 12 is light compression that is virtually indistinguishable from the original, the highest possible quality, which of course, results in the largest file size. 10 to 12 is recommended for print or other high-quality reproduction. For web images, 5 to 8 is an acceptable range.

Embed color profile — applies to JPEG images. Embeds into the JPG the current color profile, either for the original color space if not converted, or the profile selected for the Convert to profile option. The option exists for JPG so that files intended for print can include profiles, important to preserve in that case, but JPG for web may omit profiles, as the profile is excess and only increases file size.

PSD and TIF always embed profiles, and PNG never embeds profiles.

How text is positioned

Before replacing text content of each layer, the script records the position of the placeholder text. Using a text area is preferred because it adapts to single or multiple lines of content as needed. Single line text placeholders do not. When the placeholder is a text area, the current paragraph alignment determines the ultimate text position. If alignment is left, new content aligns to the top-left anchor of the text area. Right, the top-right anchor. If alignment is center, new content is positioned so that its center matches the original center of the placeholder text area. The result is the text is not only center horizontally, but vertically as well, whether single or multiple lines.

Available color profiles

For the option Convert to profile, the list of profiles from which to choose is compiled by searching known locations in the system for .icc/.icm files and extracting the profile name. This occurs each time the script is launched. The list should include most of the same profiles Photoshop displays in dialogs such as Color Settings, but it doesn’t match exactly. If a needed profile does not appear in the list, add the profile to a location both Photoshop and the script look for profiles (below), and relaunch the script.

macOS

:Library:ColorSync:Profiles

Windows

\Windows\System32\spool\drivers\color

Many scripts are free to download thanks to the support of users. Help me keep developing new scripts by supporting my work. Click the button to make a contribution of any amount. Thank you.
Download
Text Update From CSV

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.