Find Change Multi Doc

Script for Adobe InDesign
Latest update 11/27/2021, version 1.0

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

IMPORTANT: non-English languages, ensure CSV files use commas not semicolons, or the script fails. Configure Excel to use commas, or open the CSV file in a text editor and search and replace semicolons to commas. Also, if text to find or change contains Unicode characters (for example diacritics used in non-English languages), choose "CSV UTF-8 (Comma delimited)" from the Excel Save As dialog "Save as type" drop-down list. If not saved UTF-8, CSV files replace Unicode characters with question marks and the text fails to match.

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 or GREP pattern to find, and another column for its replacement.

Example data Find/Change Text

Find Change Multi Doc text data example

Example data Find/Change GREP

Find Change Multi Doc GREP data example

The first row is the header, which identifies the contents of each column. In the examples, the column headers are Find and Change. The 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 or GREP pattern to find, and which is its replacement, are selected in the script interface.

The user must decide which data type to use for the spreadsheet, either plain text “Find what” and “Change to” pairs, or GREP patterns and their replacement. The spreadsheet must be one or the other, the choice of which is selected in the script interface option Data type. This choice of Text or GREP is equivalent to selecting either the Text tab or the GREP tab in the InDesign Find/Change dialog, and all special characters available in the dialog are recognized by the script.

How to use the script

The interface is divided into three sections: Documents, Data file, and Options. Select the documents folder and data file, set the desired options, and click the OK button to begin. A progress bar is displayed while processing, and the user is notified when complete.

Documents

Folder — select the folder of InDesign documents to process. IMPORTANT: each file is opened, altered, and saved without user intervention, and there is no means to undo the changes. Make backup copies of documents before proceeding.

Include subfolders — when enabled, documents in all subfolders are also processed.

Data File (CSV)

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.

Data type — indicates whether the data is text “Find what” and “Change to” pairs, or the data is GREP patterns and their replacement. Choose the data type that matches the spreadsheet.

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 would have to be two separate find/change pairs, one capitalized, another not, and processed with Case insensitive disabled, otherwise risk the beginning of sentences becoming lowercase.

Localization

By default the script language is US English, which does not require further download or configuration. To make the script interface display other languages, first download the English i18n file. The file has interface text in English, and a second value for its translation, which for the English i18n file is the identical text. Edit the i18n file to change the second values to the translation in your language. Save the file and copy it to the script folder alongside the script file. When launched, the script detects the i18n file and the script interface displays your translated text. For more detailed instructions of how to edit and install i18n files, see How to Localize Scripts.

BUY NOW

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.