Extract InDesign IDML text to a CSV table and rebuild the file with your edits — Step-by-step guide
An InDesign .idml file is a ZIP of XML stories, and its text is spread over them in an order that is hard to follow by hand. IdmlText reads the package in your browser and gives you a CSV with one row per paragraph, in reading order, with the story ID, paragraph index, paragraph style and text. Upload the edited CSV with the original .idml and you get a new .idml with the text replaced. Nothing is uploaded.
What the sample produces
The sample is a two-story package written by a script, with a heading, a paragraph with a bold lead-in, a forced line break and a table cell. Its stories are listed in the reverse order of the spread. The check reads the extracted table and the rebuilt package with Python's zipfile and xml.etree: paragraph texts, the bold first range, the heading size and the unchanged parts are compared, and the rebuilt package is then read back to the same table.
- Paragraphs replaced
- 4, in 2 stories
- Paragraphs merged into the first range
- 1, reported in the preview
- Table paragraph left unchanged
- 1, reported in the preview
How to use it
- In InDesign, choose File, Export and pick InDesign Markup (IDML). Keep this file as the original, because the rebuilt copy is made from it.
- Choose the .idml file here. The table lists each paragraph in reading order, with its story ID, paragraph index, paragraph style and text. Download it and edit only the text column in a spreadsheet, then save it as CSV.
- Choose the edited CSV together with the same .idml. Download the rebuilt .idml; the preview lists the paragraphs that changed and any that were left alone.
Supported files
Reads IDML packages saved by InDesign: designmap.xml lists the spreads and stories, and the text is read from Stories/*.xml. The CSV has four columns, story_id, paragraph_index, paragraph_style and text, in reading order, which follows the frames on the spreads. A forced line break in a paragraph is a newline in its cell and a tab stays a tab. Rebuilding replaces only the text of paragraphs whose text changed, and each rebuilt paragraph keeps its tag, its other children and the properties of its first character range. Other character ranges in an edited paragraph are merged into the first one, so their formatting is lost, and the preview reports each one. Paragraphs that hold a table or another paragraph are left unchanged and reported, so edit table cells as their own rows. paragraph_style is read-only. Text on master pages is not read, and the layout, frames and styles are not changed. A CSV row that matches no paragraph is reported and not applied. Checked on a generated package, not one saved by InDesign, and the rebuilt file was not opened in InDesign. Up to 200 MB, read in browser memory.