Find Change From Spreadsheet
Script for Adobe InDesign
Latest update 10/17/2021, version 3.1
Reads a spreadsheet of find/change pairs and replaces each instance of matching text in the active document. A virtually unlimited number of find/change pairs are performed in a single operation rather than repeated visits to the InDesign Find/Change dialog.
- Change text based on values stored in CSV or tab-delimited text
- Option to match whole words only
- Option to ignore case
- Option to confirm each change
- User-configurable localization
How to use the script
The interface is divided into two sections: Data file and Options. Click the File button to choose the data file, enable desired options, and click the OK button to begin. The user is notified when processing is complete, or if an error occurs.
The script accepts either Comma Separated Values (CSV) or Tab-delimited Text (TXT). Excel and other spreadsheet applications can save to either format. The spreadsheet data must contain a header row, which must be the first (top) row. If the data file does not contain a header row, the user must insert a row and label the columns, and ensure the values match in the following two options:
Column head, find text — the label for the column of text to search for.
Column head, change text — the label for the column of text that will replace the discovered text.
The default column labels are Find for the column of text to find, and Change for the column of replacement text. These may be any value the user desires, provided the data file and options above agree on the value of the header row column labels. Otherwise processing will fail.
An example spreadsheet layout:
In the above example, the column heads are the default values Find and Change. When the script processes the document, all instances of colour are changed to color, afternoon is replaced with evening, and every instance of dog becomes cat.
The simple example shows only three find/change pairs. There could be hundreds, thousands even. That is the power of the script — what could take hours (or even days) can be accomplished in minutes.
Ensure the column heads Find and Change exist (or other values provided the same are entered into the script interface). Without the column heads, processing will fail.
Option: Whole word
Text matches only when whole words. If disabled, text matches also when words contain the text.
Option: Case insensitive
Text matches regardless of upper or lower case or any combination of either.
Option: Keep capitalization
Available only 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.
Option: Confirm each change
If enabled, the display is magnified to the value for the option Zoom (below), to better show the changes to confirm.
Each match discovered is selected in the layout and a confirmation dialog appears on screen. A description of the proposed change is displayed above a series of buttons:
OK — the selected text is changed as indicated, and the next proposed change is selected.
OK all — the selected text and all remaining matching instances are changed without further user intervention. This applies only to the current find/change pair searching for. When the next find/change pair begins processing, the confirmation dialog is again displayed. This repeats until all find/change pairs are processed.
Skip — the selected text is not changed, and the next proposed change is selected.
Skip all — the selected text is not changed and all remaining matching instances are ignored. Processing resumes with the next find/change pair and again the confirmation dialog is displayed.
Cancel — processing ceases without further changes. Any changes previously accepted remain. If desired, the Edit menu item Undo restores the document to its state prior to launching the script.
The confirmation dialog appears centered on screen and near the top of the window. If the dialog obscures the layout, it may be moved to another location on screen, even to a secondary display. The dialog will maintain its new position until the next launch of the script.
If any story has overset text, it is not possible to show the proposed change because it is hidden off-screen in the overset text. In this case, a warning is displayed and the user has the option to continue regardless, or decline and remedy the overset text before trying again, the recommended choice. Then each change is visible and can be confirmed.
Zoom — the percentage to which the display is magnified when processing begins. This allows the user a closer look at selected text to better judge if changes are acceptable.
Each time processing begins, the current options are preserved (including data file chosen), and the next time the script is launched, options are restored to the last values used.
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.
Find Change From Spreadsheet
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.