Osaurus XLSX
This plugin reads, creates, and modifies Excel (.xlsx) files. It uses a stateful in-memory model — you load or create a workbook, manipulate it, then save it to disk.
Workflow
Always follow this sequence:
- •read_xlsx(path) or create_xlsx(sheets) — get a
workbook_id - •write_cells / modify_xlsx — mutate the workbook in memory (optional, repeat as needed)
- •save_xlsx(workbook_id, path) — write the final .xlsx file to disk
For one-shot read operations, list_sheets and xlsx_to_csv read directly from disk without needing the full workflow.
Quick Reference
Reading
| Tool | When to use |
|---|---|
read_xlsx | Read all cell data from a file. Returns workbook_id + structured JSON. |
get_cell_value | Look up a specific cell or range from an already-loaded workbook. |
list_sheets | Quickly list sheet names without reading all data. |
Writing
| Tool | When to use |
|---|---|
create_xlsx | Start a new workbook from scratch with headers and data rows. |
write_cells | Set individual cell values in a loaded workbook. |
save_xlsx | Write the workbook to a .xlsx file. Nothing is saved until you call this. |
Transformation
| Tool | When to use |
|---|---|
xlsx_to_csv | Export a sheet as CSV or TSV text. Reads directly from disk. |
csv_to_xlsx | Parse CSV/TSV text into a new workbook. Call save_xlsx after. |
modify_xlsx | Batch operations — set cells, formulas, delete rows/columns, add/rename sheets. |
Cell References
All cell references use standard Excel notation:
- •Single cell:
A1,B5,Z100 - •Range:
A1:D10,B2:B50 - •Column letters: A=1, Z=26, AA=27, AZ=52, etc.
Value Types
When writing cell values, types are auto-detected from the string value:
| Input | Detected type | Example |
|---|---|---|
Starts with = | Formula | =SUM(A1:A10) |
| Valid number | Number | 42, 3.14, -100 |
true / false | Boolean | true |
| Everything else | String | Hello World |
You can override auto-detection with the type parameter in write_cells:
- •
"string"— force string - •
"number"— force number - •
"boolean"— force boolean - •
"formula"— force formula (adds=prefix if missing)
Tool Tips
read_xlsx
- •Returns all sheets by default. Use
sheet_nameto read a single sheet. - •Use
range(e.g."A1:D10") to limit the data returned — useful for large files. - •The returned
workbook_idis needed forwrite_cells,modify_xlsx,get_cell_value, andsave_xlsx. - •Sheet name matching is case-insensitive.
get_cell_value
- •Requires a
workbook_idfrom a priorread_xlsxorcreate_xlsxcall. - •You must provide either
cell(e.g."B5") orrange(e.g."A1:C3") — omitting both returns an error. - •Sheet name matching is case-insensitive.
list_sheets
- •Reads sheet names directly from disk — no
workbook_idneeded. - •Useful for discovering sheet names before calling
read_xlsxwith a specificsheet_name.
create_xlsx
- •Pass an array of sheet definitions, each with a
name, optionalheaders, and optionalrows. - •
headersare always stored as strings. - •
rowsvalues are auto-detected (numbers, booleans, strings). - •Remember to call
save_xlsxafterwards — nothing is written to disk until you save.
write_cells
- •If the specified
sheet_namedoesn't exist, a new sheet is created automatically. - •Each cell in the
cellsarray needs aref(e.g."B5") and avalue. - •Use
typeto force a specific value type if auto-detection isn't what you want.
save_xlsx
- •The
.xlsxextension is added automatically if missing. - •Always call this when you're done. The workbook only exists in memory until saved.
xlsx_to_csv
- •Reads directly from a file on disk — no need to
read_xlsxfirst. - •Defaults to the first sheet. Use
sheet_nameto specify a different one. - •Set
formatto"tsv"for tab-separated output.
csv_to_xlsx
- •Accepts raw CSV/TSV text in the
csv_dataparameter. - •Set
has_header: trueto keep the first row as strings (prevents number detection on headers). - •Set
delimiterto"tab"or"\t"for TSV input. - •Returns a
workbook_id— callsave_xlsxto write to disk.
modify_xlsx
- •Batch multiple operations in a single call for efficiency.
- •If
sheet_nameis omitted, operations target the first sheet in the workbook. - •Available operations:
- •
set_cell— set a cell value (ref+value) - •
set_formula— set a formula (ref+formula) - •
delete_row— delete a row by number and shift rows up (row) - •
delete_column— delete a column by letter and shift columns left (column) - •
rename_sheet— rename the target sheet (new_name) - •
add_sheet— add a new empty sheet (name)
- •
Limitations
- •
No cell formatting. The plugin reads and writes cell values only. Fonts, colors, borders, and other formatting from existing files are not preserved.
- •
No images or charts. Embedded objects in existing files are not read or preserved.
- •
Formulas are stored, not evaluated. When you write
=SUM(A1:A10), the formula text is saved. Excel will evaluate it when the file is opened. - •
Large files. Reading very large spreadsheets (100k+ rows) loads all data into memory. Use the
rangeparameter withread_xlsxto limit data. - •
Round-trip fidelity. Reading an existing .xlsx and saving it back will preserve cell values but may lose formatting, charts, images, and other advanced features.
Example: Read and Summarize
1. read_xlsx(path="sales.xlsx") → workbook_id, sheets with cell data 2. Agent analyzes the data and responds with a summary
Example: Create a New Spreadsheet
1. create_xlsx(sheets=[
{name: "Employees", headers: ["Name", "Department", "Salary"],
rows: [["Alice", "Engineering", "120000"],
["Bob", "Marketing", "95000"]]}
])
→ workbook_id
2. save_xlsx(workbook_id, path="employees.xlsx")
→ file written to disk
Example: Read, Modify, and Save
1. read_xlsx(path="budget.xlsx")
→ workbook_id
2. write_cells(workbook_id, sheet_name="Q4",
cells=[{ref: "B10", value: "=SUM(B1:B9)", type: "formula"}])
→ cell written
3. save_xlsx(workbook_id, path="budget_updated.xlsx")
→ file written to disk
Example: CSV to Excel
1. csv_to_xlsx(csv_data="Name,Age\nAlice,30\nBob,25", has_header=true) → workbook_id 2. save_xlsx(workbook_id, path="people.xlsx") → file written to disk
Example: Batch Modifications
1. read_xlsx(path="data.xlsx")
→ workbook_id
2. modify_xlsx(workbook_id, sheet_name="Sheet1", operations=[
{type: "set_cell", ref: "A1", value: "Updated Title"},
{type: "set_formula", ref: "D10", formula: "=AVERAGE(D1:D9)"},
{type: "delete_row", row: 5},
{type: "add_sheet", name: "Summary"},
{type: "rename_sheet", new_name: "Data"}
])
→ 5 operations applied
3. save_xlsx(workbook_id, path="data_modified.xlsx")
→ file written to disk