Working with DOCX and XLSX in Claude Code
Who this is for: Researchers who work with Word documents (drafts, transcriptions, notes) and Excel/spreadsheet files (data, lists, tables). This document covers reading, editing, extracting from, and analysing these formats in Claude Code, with no programming required.
DOCX: Word documents
What Claude can do with a Word file
Claude Code reads .docx files directly — no conversion needed, no upload, no copy-paste. It sees the text content: paragraphs, headings, tables, footnotes. It does not see formatting (fonts, colours, tracked changes) but it sees the words.
Reading and summarising:
> Read draft_chapter3.docx and give me a 3-paragraph summary of the argument.
Line editing and revision:
> Read my_draft.docx
Please review it for:
- Clarity of argument in each paragraph
- Consistency of academic register
- Any sentences that are unclear or too long
Write your suggestions as a revised version, saving to my_draft_revised.docx
Structural feedback:
> Read grant_proposal.docx
Assess the structure: does the argument flow logically?
Are the section lengths appropriate?
What is missing or underdeveloped?
Checking against requirements:
> Read my_abstract.docx
The journal requires: max 250 words, structured as background / aim /
methods / results / conclusion.
Does my abstract meet these requirements? If not, revise it to fit.
Editing and writing back to DOCX
Claude Code can write text to .docx files. Important caveat: Claude writes the text content, but does not reproduce the original formatting (fonts, styles, tracked changes, embedded images). For formatted documents, the cleanest workflow is:
Option 1 — Write a new clean DOCX:
> Read my_draft.docx, revise it for clarity and concision,
and save the revised text to my_draft_v2.docx
The output is a plain Word file with the revised text. You apply your own styles.
Option 2 — Output as markdown, then paste back:
> Read my_draft.docx and rewrite the introduction section.
Give me the rewritten text in plain text, so I can paste it into Word myself.
You copy Claude's output and paste it back into your own document. Preserves your formatting.
Option 3 — Work in markdown, export to DOCX at the end:
Many researchers find it easier to draft in .md files (which Claude handles perfectly) and convert to DOCX only at the final stage. Pandoc (a free command-line tool) converts markdown to Word with one command; Claude Code can run it for you.
Batch operations on DOCX files
> I have 8 Word files in /drafts/ — these are chapter drafts.
For each one, read it and write a 1-paragraph status note:
what is the argument, how complete does it seem, what appears to be missing?
Compile the status notes into chapters_status.md
> There are transcription files in /transcriptions/ in DOCX format.
Read each one and extract all occurrences of the word "heresy" or
its Latin equivalents (heresis, haeresis).
For each occurrence, give the surrounding sentence and the filename.
Save to heresy_mentions.md
Working with footnotes and references
Claude reads footnotes from DOCX files. You can ask:
> Read my_paper.docx
Extract all footnotes that cite primary sources (as opposed to secondary literature).
List them with the footnote number and the text of the citation.
> Read draft_article.docx
Check whether all sources cited in the footnotes appear in the bibliography at the end.
List any that are cited but not in the bibliography, and any in the bibliography
but not cited.
Note: Claude cannot check whether citations are accurate (i.e., whether the page number or quotation matches the actual source). It can check internal consistency — that cited items appear in both places — but not correctness against external sources.
XLSX: Spreadsheets and structured data
What Claude can do with a spreadsheet
Claude Code reads .xlsx files and can see the data in the cells. It works best with structured tabular data — rows and columns with clear headers. It can read, summarise, filter, analyse, and write modified versions.
Reading and describing a spreadsheet:
> Read network_data.xlsx and describe what is in it:
how many rows, what are the columns, what does the data appear to represent?
Filtering and extracting rows:
> Read depositions.xlsx
Find all rows where the column "status" is "perfectus"
and the column "date" is before 1300.
Write those rows to perfecti_pre1300.xlsx
Summarising data:
> Read survey_results.xlsx
Give me a summary of the responses to the question in column C
("What is your main research method?").
How many distinct answers appear, and what are the most common?
Checking for issues:
> Read my_database_export.xlsx
Check for:
- Duplicate rows (same person_id appearing more than once)
- Empty required fields (person_id, name, date must all be filled)
- Dates that appear to be outside the expected range (1200–1400)
Report all issues with the row number.
Writing back to XLSX
Claude Code can create and modify .xlsx files. Useful patterns:
Add a new column based on existing data:
> Read persons.xlsx
It has a column "name_latin" with Latin name forms.
Add a new column "name_normalised" with a standardised English/French form
of each name (e.g. Guillelmus → Guillaume, Bernardus → Bernard).
Save as persons_normalised.xlsx
Merge two spreadsheets:
> I have two files: persons.xlsx and depositions.xlsx
persons.xlsx has columns: person_id, name
depositions.xlsx has columns: deponent_id, date, location
The deponent_id in depositions matches person_id in persons.
Create a merged file with all deposition rows, but with the person's
name added from persons.xlsx.
Save as depositions_with_names.xlsx
Convert a spreadsheet to a different format:
> Read network_edges.xlsx and save it as network_edges.csv
> Read data.xlsx and format it as a markdown table, save to data_table.md
Light analysis with Claude
Claude can do basic quantitative analysis on spreadsheet data — counting, grouping, summarising. For anything more complex (statistics, visualisation, modelling), you would normally use R, Python, or a dedicated tool. But for exploratory analysis of research data, Claude is often sufficient.
Frequency counts:
> Read depositions.xlsx
How many depositions are there per location?
Rank locations by number of depositions, highest first.
Cross-tabulation:
> Read network_data.xlsx
How many edges are there between perfecti and credentes,
versus between perfecti and other perfecti?
Timeline analysis:
> Read events.xlsx — it has a "date" column with years.
Show me how many events per decade (1240s, 1250s, etc.)
from 1230 to 1330.
Finding patterns:
> Read persons.xlsx
Are there any persons who appear in more than 5 depositions?
List them with their deposition count.
Limitations with spreadsheets
Formulas are not executed. If your spreadsheet uses Excel formulas (=SUM, =VLOOKUP, etc.), Claude sees the formula text, not the computed result. Work with exported values if formulas are critical, or ask Claude to recompute the logic in its own way.
Pivot tables and charts are not readable. Claude sees the underlying data sheet, not pivot table outputs or charts. Export or describe what you need.
Very large spreadsheets may be slow or truncated. A spreadsheet with 50,000 rows will approach context limits. For large datasets, ask Claude to work on a subset, or filter before loading:
> Read the first 500 rows of large_dataset.xlsx and describe their structure.
Formatting is not preserved. If your XLSX has colour-coding, conditional formatting, or merged cells for visual organisation, Claude reads the cell values but not the formatting.
Combining DOCX and XLSX in a workflow
A common research pattern: extract structured data from texts (DOCX) into a spreadsheet (XLSX), then work with the spreadsheet.
> Step 1: Read all DOCX files in /transcriptions/
For each deposition, extract: deponent name, date, location, inquisitor,
persons mentioned.
Save as raw_extractions.csv
> Step 2: Read raw_extractions.csv
Check for obvious errors: dates outside 1200-1400, empty required fields,
duplicate names that are likely variants.
Flag issues in a column called "review_flag".
Save as raw_extractions_flagged.csv
Then the researcher reviews the flagged rows, corrects them, and the CSV is ready for database import.
Telling Claude about your data structure
For recurring work on the same dataset, put the structure in your CLAUDE.md:
## Data files
- persons.xlsx — columns: person_id (int), name_latin, name_normalised,
status (perfectus/credens/witness/unknown), source_ref
- depositions.xlsx — columns: dep_id, deponent_id (links to persons.person_id),
date (YYYY or YYYY-MM-DD), location, inquisitor, charges
- network_edges.xlsx — columns: source_id, target_id, relation_type, date, source_ref
Date format: YYYY where exact date unknown, YYYY-MM-DD where known.
person_id and dep_id are assigned by me — do not infer them, ask if needed.
With this in CLAUDE.md, you can say "add this deposition to depositions.xlsx" and Claude knows the structure without you explaining it each time.
Common issues and solutions
"Claude says it cannot read the file / file not found"
Check your current folder with pwd. Navigate to the right place with cd, or use the full file path.
"The output DOCX lost all my formatting" Expected — Claude writes plain text content, not styles. Use Option 2 (copy-paste back into your styled document) if preserving formatting matters.
"Claude got the numbers wrong in my spreadsheet" Always verify quantitative results. Claude can make arithmetic errors, miss rows, or misread column relationships. Use Claude's output as a draft to check, not a final answer.
"Claude can only see part of my spreadsheet" The file may be too large for the context window. Ask Claude to work on a subset, or split the file first.
"I need Claude to work with a .xls file (old Excel format)"
Save as .xlsx first — open in Excel or LibreOffice and Save As → xlsx. Claude handles .xlsx; the older .xls format may not work correctly.
Related
-
A7.working-with-pdfs — the same patterns for PDF documents
-
A9.markdown-project-memory — putting data structure in CLAUDE.md
-
A13.examples-dissinet-usecases — DISSINET use cases involving transcriptions and database entry
-
A.critical.limitations — verifying Claude's outputs, especially quantitative ones