Skip to main content
Glama
README.md
# sheetforge

Spreadsheets for AI agents. No GUI, no account, no vendor lock-in: a CLI, a Python API and an MCP server that any agent can drive — Muse, Antigravity, Codex, Claude Code, or a local model.

It reads, creates and edits real .xlsx files with openpyxl, so install the package and you are set.

## Install

```sh
pip install sheetforge
```

## Use it from the terminal

```sh
# what sheets are in a workbook?
sheetforge sheets -i sales.xlsx

# what is in it?
sheetforge describe -i sales.xlsx
sheetforge read -i sales.xlsx --sheet Sales
sheetforge read -i sales.xlsx --sheet Sales --range A1:C3

# build a workbook from a JSON structure
sheetforge create -o sales.xlsx --structure '{
  "sheets": [{"name": "Sales", "rows": [["Month", "Units"], ["Jan", 12], ["Total", "=SUM(B2:B2)"]]}]
}'

# or build it from a CSV file
sheetforge create -o sales.xlsx --csv sales.csv

# change one cell (a value or a formula)
sheetforge edit -i sales.xlsx --sheet Sales --cell B2 --value 15
sheetforge edit -i sales.xlsx --sheet Sales --cell B4 --value '=SUM(B2:B3)'

# add a sheet
sheetforge add-sheet -i sales.xlsx --name Notes --rows '[["hello", "world"]]'
```

## Spec format

```json
{
  "sheets": [
    {"name": "Sales",
     "rows": [["Month", "Units"], ["Jan", 12], ["Total", "=SUM(B2:B2)"]],
     "freeze": "A2",
     "widths": {"A": 12, "B": 8}}
  ]
}
```

Cell values are text, numbers, true/false or empty. A string starting with `=` is stored as a formula (Excel or LibreOffice calculates it when the file opens; reading returns the formula text).

## Use it from Python

```python
from sheetforge import create_workbook, read_workbook, describe, edit_cell, add_sheet, workbook_from_csv

create_workbook({"sheets": [{"name": "Sales",
                              "rows": [["Month", "Units"], ["Jan", 12], ["Total", "=SUM(B2:B2)"]]}]},
                "sales.xlsx")

read_workbook("sales.xlsx", sheet="Sales")  # rows, dimensions
describe("sales.xlsx")  # size plus one entry per sheet
edit_cell("sales.xlsx", "Sales", "B2", 15)
add_sheet("sales.xlsx", "Notes", rows=[["hello"]])
workbook_from_csv("sales.csv", "sales.xlsx")
```

## MCP server

```sh
sheetforge mcp
```

Tools: `create_workbook`, `read_workbook`, `describe_workbook`, `list_sheets`, `edit_cell`, `add_sheet`, `workbook_from_csv`.