Find Change From Spreadsheet

JavaScript for Adobe InDesign
Latest update 6/24/2019

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
Find Change From Spreadsheet screen
Download
Find Change From Spreadsheet

You decide. Reward the author an
amount the solution is worth to you.

Instructions for use

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.

Data File

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:

Find Change from Spreadsheet data example

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: Confirm each change

If enabled, the display is magnified to the value for the option Zoom (below), to better show the changes to confirm. Also, Show Hidden Characters is enabled and the display mode is changed to Normal. After processing is complete, all prior view settings are restored.

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:

Find Change from Spreadsheet screen 2

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.

Settings

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.

Localization

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.

Download
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.

CHANGE LOG

Version 2.0 (190624)

  1. Revise settings.
  2. Miscellaneous.

Version 19.3.10 (1.4.1)

  1. Confirm dialog wrap change text in quotes.

Version 19.3.8 (1.4)

  1. Add license.

Version 19.2.24 (1.3.1)

  1. Revise inconsistent settings error message.

Version 19.2.23 (1.3)

  1. Update settings file error handling.
  2. Revise error messages.
  3. Internationalization.

Version 19.2.21 (1.2)

  1. Test for overset text before UI rather than after OK.
  2. Miscellaneous.

Version 19.2.6 (1.1)

  1. Preserve whole word option.

Version 19.1.25 (1.0)

  1. Initial release.