Find Change CSV Multi Doc

Script for Adobe InDesign
Latest update 11/8/2022, version 2.4

The script reads a spreadsheet of find/change pairs, either text or GREP, and replaces each instance of matching text in every document in a selected folder, including subfolders if desired. A virtually unlimited number of find/change pairs are performed on multiple documents in a single operation rather than countless visits to the InDesign Find/Change dialog.

  • Find/Change across multiple documents
  • Match whole words only
  • Ignore case
  • Keep capitalization
  • User-configurable localization
Download
FREE 10 DAY TRIAL

Single-user perpetual license

How-to Video

Before using the script

The script requires a spreadsheet of find/change pairs, saved as Comma Separated Values (CSV format). The spreadsheet must have at least two columns, one for the text to find, and another for its replacement.

Find Change CSV Multi Doc text data example

The first row is the header, which identifies the contents of each column. In this example, the column headers are Find and Change. Using this data file, the script changes colour to color, afternoon is replaced with evening, and every instance of dog becomes cat.

These columns could just as well be labeled “match” and “replace,” 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 text to find, and which is its replacement, are selected in the script interface.

In each row, the values for find and change can be either text or a regular expression (GREP). Rows may differ even; some text, some regular expressions. To inform the script that the text to match is a regular expression, begin and end the expression with forward slashes. Flags after the trailing slash are ignored, as the script always replaces all instances (g flag for global) and whether to ignore letter case (i flag for insensitive) is controlled by the script interface option Case insensitive. If the expression includes any capture groups, the normal placeholders are recognized in the replacement, i.e. $1, $2, etc. In the rare case the text to find happens to begin with, and end with a forward slash, there is no choice but to use a regular expression, because the script always sees this as the signal for a regular expression. In that case, construct a regular expression that matches the desired text but escapes the slashes and any other punctuation characters that could be interpreted as regular expression commands.

Values in the find column of the spreadsheet are equivalent to values entered into the Text tab or the GREP tab of the InDesign Find/Change dialog. All special characters available in the dialog are recognized by the script.

How to use the script

The interface is divided into four sections: Documents, Data file, Options, and Output. Select the folder of InDesign documents, the data file, options, and output folder, then click the OK button to begin. A progress bar is displayed while processing, and when complete, the number of documents processed is reported. If problems occur, a log file is written to the output folder, and the user is notified.

Section 1: Documents

Folder — select the folder of InDesign documents to process.

Include subfolders — when enabled, documents in all subfolders are also processed, and the same subfolder structure is created in the output folder.

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 used in 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 find — select the column of text to find or GREP patterns to match.

Column change — select the column of replacement text.

Section 3: Options

Whole word — text matches only when whole words. If disabled, text matches also when words contain the text. For GREP, this option is achieved by wrapping the GREP pattern in \< and \>, which indicates whole word. The same could be done to patterns in the data and get the same result. The option exists to simplify the data file if desired. IMPORTANT: do not use this option if GREP patterns in the data file already contain the command for whole word. Doing so prevents patterns from matching.

Case insensitive — text matches regardless of upper or lower case, or any combination of either. For GREP, this option is achieved by prefixing the GREP pattern with (?i), which indicates case insensitive. The same could be done to patterns in the data and get the same result. The option exists to simplify the data file if desired. IMPORTANT: do not use this option if GREP patterns in the data file already contain the command for case insensitive. Doing so prevents patterns from matching.

Keep capitalization — available when the option Case insensitive is enabled. When the text found is capitalized, the change is capitalized even if not capitalized in the spreadsheet. If the text found is not capitalized, the spreadsheet data is used as-is. This is useful for words that are normally not capitalized, but could appear at the beginning of sentences, requiring capitalization. Without this option, such cases require two separate find/change pairs, one capitalized, another not, and processed with the Case insensitive option disabled, otherwise risk the beginning of sentences becoming lowercase.

Section 4: Output

Folder — the location to which altered documents are saved. Click the button Folder and navigate to the desired location.

Original file name + — a suffix of characters appended to each document saved. The characters entered must be legal to use in file names. Having no suffix is allowed, in which case the output file names exactly match the input file names.

When documents are saved, any existing documents of the same name in the output folder are replaced without alert.

Language

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.

English: find-change-csv-multi-doc-en-i18n.zip

Download
FREE 10 DAY TRIAL

Single-user perpetual license

Change log: find-change-csv-multi-doc.txt

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.