Data Sources for InDesign Scripting Workflows
We at T+S are often asked by our customers which data sources can be attached to InDesign scripting extensions or plugins.
One can distinguish between online data sources and offline data sources. An online data source is a live access of a database or product information management (PIM) database. On the other hand, an offline data source is always a file created by a data system and processed within InDesign at a later time. Both online and offline data sources have advantages and disadvantages that depend on how they are used.
InDesign extensions (also called plugins) can work with the following offline data sources:
- Excel files
- CSV files
- XML files
- JSON files
Offline data sources that InDesign can work with include:
- Web service (REST or SOAP)
- ODBC data access
- Native database drivers
Excel files can be read directly by an InDesign plugin. We at T+S do not recommend this approach, however, because Excel files can contain quite a few “pitfalls” such as faded out columns, formatted cells, or applied filter conditions. These modifications have to be taken into account during an import, making the development of the import routine time-consuming before one even comes to the actual task at hand — automation.
It is more elegant to insert the content of an Excel file using the clipboard with copy and paste in a text field within a plugin developed by T+S. The method of using the clipboard removes all formatting, making the import routine quick and manageable. This approach always yields a text file separated by tabs.
CSV files are flat text files that in the first row contain a header definition of the data fields and starting in the second row contain the actual data. Data fields of a data set are normally separated by a comma, semicolon, or tab. When the field separator character also can be found within the relevant data to be used, the affected fields have to be escaped by quotation marks (quotes).
XML files are an elegant and efficient way of obtaining data with multiple-level hierarchies (1:n relationships) from a source. Using an InDesign plugin to work with XML files that are several hundred megabytes large can be done easily. However, some time may be needed between generating the XML files and reading them in.
JSON files are used primarily to exchange data with web services. They are, just like XML files, an elegant and efficient way to transfer structured hierarchical data from a database system to a plugin.
Web service (REST or SOAP)
A web service is a service that makes available data through the http or https protocols. This service normally receives its data from a database or a product information management (PIM) system.
The advantage of having an InDesign plugin receive its data from a web service is the currency of the data, because the access takes place online. In the case of CSV, XML, or JSON files, there is always a bit of a span of time between when the files are created and when the files are read into the plugin.
ODBC database driver
Connecting InDesign Plugins to a database using ODBC is only possible with third party plugins. So we do not recommend this possibilty.
Native database driver
However, every time the database is updated, there is the question beforehand of whether afterwards the plugin will access the data tables successfully. It is therefore necessary to very carefully evaluate the advantages and disadvantages of this method.
Get in touch about InDesign scripting now
Discover a world of document production possibilities with InDesign scripting from T+S. Discuss your needs with our expert, Michael Tschuschner.