# Can an AI agent create Word, Excel and PDF files in the cloud?

> Yes. A Sanbox OpenCode Computer ships LibreOffice Writer and Calc, pandoc, python-docx, openpyxl, xlsxwriter and reportlab, so an agent can write .docx, .xlsx and .pdf files you download.

- Source: Sanbox knowledge base, by Sanlabs GmbH
- URL: https://sanbox.cloud/kb/teams/agents-that-write-word-excel-and-pdf/
- Type: how-to
- Section: Agents for teams
- Language: en
- Published: 2026-11-06
- Updated: 2026-11-06

Yes. An agent can create Word, Excel and PDF files on any Linux machine that has the right libraries, and a Sanbox OpenCode Computer comes with them installed: LibreOffice Writer and Calc, pandoc, python-docx, openpyxl, xlsxwriter, reportlab, pdfplumber and pandas. You copy your input files in, ask the agent for the documents, and copy or download the results. Slides (PowerPoint) aren't included today; a slides-capable office Computer is enabled on request.

## Run this with your agent

```text
Read https://sanbox.cloud/kb/teams/agents-that-write-word-excel-and-pdf.md and follow it to have a Sanbox Computer produce Word, Excel and PDF files.
If the Sanbox CLI is missing, install it with `npm install -g @sanlabs/sanbox-cli@latest`
and sign in with `sanbox login`. Show me each command before you create, stop or delete a Computer.
```

## What's installed for documents?

| Format | Tools in the OpenCode Computer |
|---|---|
| Word (.docx) | python-docx, LibreOffice Writer, pandoc |
| Excel (.xlsx) | openpyxl, xlsxwriter, pandas, LibreOffice Calc |
| PDF, create | reportlab, LibreOffice |
| PDF, read and edit | pdfplumber, pypdf, pdfminer.six, poppler-utils, qpdf |
| Charts and images | matplotlib, Pillow |
| Data | pandas, numpy, python3 and pip |

Fonts are installed too, so documents render with real typefaces. The image doesn't include python-pptx or LibreOffice Impress.

## 1. Create an OpenCode Computer template

```bash
sanbox model-providers list --json
sanbox model-providers models <provider-id> --json
sanbox templates create --name "Office work" --type opencode-computer \
  --model-provider <provider-id> --model <model-id> --json
sanbox templates validate <template-id> --json
```

Document work needs no internet access beyond the model, so you can leave out `--network-policy`. The Computer then stays deny-by-default and still reaches the template's model provider.

## 2. Start the Computer and copy your files in

```bash
sanbox run --template <template-id> --json
sanbox runs get <run-id> --json
sanbox cp ./input <run-id>:/workspace
```

Wait until `runs get` shows the run as `running` before you copy. `sanbox cp` creates the folder under its own name, so `./input` arrives as `/workspace/input`.

To check the libraries yourself:

```bash
sanbox exec <run-id> -- python3 -c "import docx, openpyxl, xlsxwriter, reportlab, pdfplumber; print('ok')"
```

## 3. Ask for the documents

Open the Computer in the [Sanbox console](https://console.sanbox.cloud) and give the agent the task in chat. Be specific about inputs, outputs and tools:

```text
Read /workspace/input/sales.csv.
Write /workspace/output/sales.xlsx with one sheet per region and a totals sheet, using openpyxl.
Write /workspace/output/summary.docx with a one-page summary and a bar chart made with matplotlib, using python-docx.
Convert summary.docx to /workspace/output/summary.pdf with LibreOffice in headless mode.
```

Putting every deliverable under `/workspace/output` matters: that's the folder Sanbox exports as the run's artifacts. You can also drive the agent from code through the OpenCode SDK with `sanbox opencode connect <run-id> --expires 1h`.

## 4. Download the results

While the Computer runs, copy the folder out:

```bash
sanbox cp <run-id>:/workspace/output .
```

This creates `./output` on your machine. Or stop the Computer and download its artifacts:

```bash
sanbox runs stop <run-id> --wait --json
sanbox runs artifacts <run-id> --json
sanbox runs download <run-id> --output ./results --json
```

Downloads return each file's path, size and SHA-256 digest. Each file can be up to 256 MiB.

## How do I convert Word to PDF?

LibreOffice converts documents from the command line. Its `--headless` option runs without a user interface, and `--convert-to pdf` writes the PDF to the current directory, or to the folder given with `--outdir`. For example, the agent can run:

```bash
sanbox exec <run-id> --cwd /workspace/output -- soffice --headless --convert-to pdf summary.docx
```

Check complex layouts in Microsoft Word or Excel before you send them. LibreOffice and the Python libraries write standard files, but they aren't Microsoft Office.

## Slides (PowerPoint): enabled on request

The OpenCode Computer doesn't make slide decks today. A slides-capable office Computer, with tools for PowerPoint files, is enabled per organisation on request: [Enable it for your organisation](mailto:sales@sanlabs.ai?subject=Enable%3A%20Slides-capable%20office%20Computer).

## Snapshot it

If your team adds its own templates, fonts or helper scripts, set them up once, stop the Computer and snapshot it:

```bash
sanbox snapshots create --run <stopped-run-id> --name office-base --wait
sanbox run --snapshot office-base --json
```

Each run from the snapshot starts with those files already in place.

## What this doesn't do

- **Slides.** No python-pptx and no LibreOffice Impress.
- **Microsoft Office.** Files are made with open-source tools, so check formatting that depends on Word or Excel.
- **Huge files.** Artifact downloads are limited to 256 MiB per file, and the disk is 1 to 8 GB.
- **Files outside `/workspace/output`.** Only that folder is exported as artifacts. Use `sanbox cp` for anything else.

## Related

- [How do I give every employee their own AI agent computer?](https://sanbox.cloud/kb/teams/agent-computer-for-every-employee/)
- [How do I run OpenCode as a server on a remote computer?](https://sanbox.cloud/kb/coding-agents/opencode-server-on-a-remote-computer/)
- [How do I run 10 coding-agent tasks in parallel without them clashing?](https://sanbox.cloud/kb/parallel-work/run-coding-agent-tasks-in-parallel/)
- [What survives when an agent's computer stops?](https://sanbox.cloud/kb/agent-computers/what-survives-a-stop/)

## Sources

- LibreOffice Help, [Starting LibreOffice with parameters](https://help.libreoffice.org/latest/en-US/text/shared/guide/start_parameters.html) (`--headless`, `--convert-to`, `--outdir`), checked 2026-11-06

## Next step

Talk to us at sales@sanlabs.ai. Sanlabs' forward-deployed engineers build agent use cases with your team, with experience in aviation, pharmaceuticals, supply chain and logistics, and internal admin workflows. How we work: https://sanbox.cloud/kb/teams/forward-deployed-engineering.md

Existing customers can use Sanbox from a coding agent: install the CLI with `npm install -g @sanlabs/sanbox-cli@latest`, sign in with `sanbox login`, then run `sanbox skill` for the full agent guide.
