Processing

Extract Text

Writes the text of each PDF, Word, Excel, PowerPoint, email, RTF, HTML or text file to its own UTF-8 .txt file, and reports documents that need OCR or cannot be read.

Free Command line: extract-text Version 1.0

Extract Text reads each document in the input folder and writes its text to a .txt file in the run folder, keeping the folder structure. The original extension stays in the name (report.docx.txt, report.pdf.txt), so documents with the same name but different types never overwrite each other. It reads the modern Office formats and also Word, Excel and PowerPoint 97-2003 files (.doc, .xls, .ppt) directly; Microsoft Office is not needed.

The text includes more than the main body. For PDFs it includes annotations and form fields. For Word it includes headers, footers, footnotes, comments and tracked deletions. For Excel it covers every sheet, hidden sheets included, with each row on one tab-separated line. For PowerPoint it includes speaker notes. For emails it gives the subject, sender, recipients, attachment names and body. Every file is reported: scanned PDFs, password-protected files and unsupported types are listed with a reason, never skipped silently.

Use it when

How to run it

  1. Choose the folder of documents as Input.
  2. Choose an Output folder outside the input folder.
  3. Leave location-headers on to mark pages, sheets and slides in the text, or turn it off for plain text only.
  4. Click Run and read the notes for counts of documents that need OCR or could not be read.
  5. Click Open report and filter the Status column.
  6. Run OCR on any PDFs reported as needing it, then run Extract Text again on the OCR output.

Settings

Every setting has the same help beside it in the app. On the command line, pass each as --name value; ltk help extract-text lists them.

Settings

SettingWhat it doesType and default
Location headers
--location-headers
Mark where text came from inside each text file: page, sheet and slide headings (===== Page 3 =====) and labels such as [Comment B7]. Off: the text only.
When on, the text file has headings such as ===== Page 3 =====, ===== Sheet: Ledger ===== or ===== Slide 2 =====, and labels such as [Comment B7], [Tracked deletion], [Annotation] and [Notes]. Turn it off when the text is going into a system that expects only the document's own words. Email field labels (Subject, From) are kept either way.
yes/no
true

Common settings

SettingWhat it doesType and default
Input required
--input
Folder (or single file) to read. It is opened read-only and never modified. folder
empty
Output required
--output
Folder for reports. Must not be inside the input folder. Each run gets its own sub-folder. folder
empty
Recurse
--recurse
Include sub-folders. yes/no
true
Extensions
--extensions
Only process these extensions (e.g. .pdf, .docx). Empty means the tool's default set. list
empty
Parallelism
--parallelism
Files processed at once. Use 1-2 for spinning disks or network shares. number
4

What you get

Each run creates its own folder inside the output folder, with the report extract-text.csv, errors.csv and manifest.json (see Run folders and manifests).

Report columns

Check the result

Tips
  • Excel cells give their saved values. A formula is shown only when the cell has no saved value.
  • For Word 97-2003 files, fields give their saved results (a date, for example), not the field codes.
  • Emails with no file extension are picked up automatically when extensions is left empty.
  • The same input always produces exactly the same text files, with the same hashes.
Watch out for
  • A character count of zero, or a much lower count than expected, usually means the document is a scan. Check the Status column rather than assuming the document is blank.
  • Password-protected files are not extracted. Remove the passwords with Decryption first, then extract from the unlocked copies.
  • Text from tracked deletions, comments and hidden sheets is included and labelled. If the text is going to another party, consider whether that content should be there.

From the command line

The command line is part of LitTechKit Pro. See Command line.

ltk run extract-text --input "D:\Matter\Production 1\NATIVES" --output "D:\Matter\Production 1\Text" --location-headers false

Related tools