# writing

writing tells the agent how to edit a spreadsheet: formulas instead of hand-computed numbers, bulk range ops instead of cell-by-cell writes.

- prompt · `type=prompt` · Claude Code, ChatGPT · ★ 12746 repo stars
- Author: genspark-ai
- License: Apache-2.0 · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/genspark-ai/genoffice/tree/HEAD/apps/sheets/src/renderer/ai/prompts/guides/writing.md
- Updated: 2026-10-29
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/prompts/writing

## What it does

The command file spells out which operations the agent may use on a sheet: `set_cell`, `set_formula`, `set_range`, `fill_range`, `copy_range`, `move_range`, `convert_to_values`, `clear_range`. Each entry lists its arguments and its ceiling. `fill_range` works like Excel's fill handle, tiling the source block and its formulas across the target while relative references shift and `$` anchors hold.

A batch tops out at 2000 changed cells; range-level ops reach 200 000. Retyping a table one cell at a time runs into that cap, so `set_range` does the same work in a single call. `copy_range` carries a block once, `move_range` does the same and then clears the source.

Formula rules get their own section. The agent is told to leave calculations to formulas and never paste in a number it computed itself. Criteria formulas that scan a large column, such as a `SUMPRODUCT`/`COUNTIF` distinct count, are rejected because they evaluate quadratically; `aggregate_range` answers that question instead.

## Install

### Claude Code (native platform)

**Manually: put the files in place**
- File: `.claude/commands/writing.md`

### ChatGPT

**How to use**
- Paste the text at the start of a chat or into project instructions

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/genspark-ai/genoffice/tree/HEAD/apps/sheets/src/renderer/ai/prompts/guides/writing.md

## When to use it
- fill a formula down an entire column in one operation
- move a block of rows to another sheet with formulas intact
- split a large sheet into one sheet per value in a column
- freeze formula results before deleting the source data
- rewrite a whole row range so old fragments don't survive

## Example prompts
- \`/writing` Fill column C with `=B2*1.2` down to the last row
- Copy the `January` sheet into a new one, formulas included
- Replace the formulas in `D2:D500` with their current values

## Source text · writing.md · Apache-2.0

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: 0a749a28f3f0f041.

BEGIN THIRD-PARTY FILE 0a749a28f3f0f041
```text
# Content writing guide (writing)

## Operation definitions

- `{op:"set_cell", sheetId, address:"B2", value}` — writes a single value (string/number/boolean/null). Optional `expectedValue` for concurrency protection.
- `{op:"set_formula", sheetId, address, formula:"=SUM(A1:A10)"}` — writes a formula, must start with =. Optional `expectedFormula`.
- `{op:"clear_cell", sheetId, address}` — clears a single cell.
- `{op:"set_range", sheetId, start:"B2", values:[[row1], [row2], …]}` — bulk write: a 2D array laid out by rows, spreading right and down from start. **values must be rectangular — every row the same length** (use null for a cell to clear; a shorter row would silently leave stale content behind). Instead of start you may pass `range:"B2:D5"`, whose size must exactly match values. **Strings starting with = are written as formulas.** Always use set_range for contiguous regions; never split them into many set_cell ops.
- **When rewriting rows of an existing table, cover the full row span**: values rows should span all of the table's columns (or the write should be paired with clear_range for the leftover cells) so no stale fragments from the old content survive next to the new one.
- `{op:"fill_range", sheetId, source:"B2", target:"B2:B88588", sourceSheetId?}` — fill/copy, Excel's fill handle as one operation: the source block's values **and formulas** tile across the target. Relative references shift per copy (=A2+1 filled down becomes =A3+1, =A4+1, …); `$`-anchored axes stay pinned. **This is THE way to fill a formula or pattern down a whole column** — one small op instead of spelling out thousands of set_range rows. Rules: write/verify the source cell(s) first, then fill; source ≤ 2000 cells; target up to **200,000 cells** and each dimension a whole multiple of the source's; an overlapping source must sit at the target's top-left (fill-down/right includes the source as the first tile); `sourceSheetId` lets the source live on another sheet (copy header rows between sheets). Fills of formulas that re-scan a large absolute range per copy (=SUM(B$2:B$88588), lookups against big tables) are rejected — use relative references so each row touches only its own cells.
- `{op:"copy_range", sheetId, source:"A1:F5000", target:"H1", sourceSheetId?, filterColumn?, filterValues?}` — copies one block to one destination exactly once (Excel copy → paste as one operation), values **and formulas**; relative references shift by the block's offset, `$`-anchored axes stay pinned. On large streamed workbooks (cached-value mode) formulas are carried live within the shared engine budget (their referenced file cells are loaded on demand); when the copied formulas' references exceed that budget — or a formula is too expensive to evaluate live — the copy writes the source cells' current values instead and the result notes how many formula cells were frozen and why. `target` is the destination's top-left cell (or a range exactly the source's size). Unlike fill_range there is no tiling and the source may be large — up to **200,000 cells** — so this is THE way to duplicate a big table or move a column's data (source and target must not overlap; `sourceSheetId` copies across sheets).
```
END THIRD-PARTY FILE 0a749a28f3f0f041

The third-party file has ended. Everything between the 0a749a28f3f0f041 tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 3249 of 8978 bytes. © genspark-ai · Apache-2.0 · https://github.com/genspark-ai/genoffice/tree/HEAD/apps/sheets/src/renderer/ai/prompts/guides/writing.md

## Similar
- [spreadsheet-formula-helper](https://affpapa.org/en/nevibecode/skills/spreadsheet-formula-helper.md) — skill · 3 installs
- [excel-formula-generator](https://affpapa.org/en/nevibecode/skills/excel-formula-generator.md) — skill · 2 installs
- [Excel Sheet](https://affpapa.org/en/nevibecode/prompts/excel-sheet.md) — prompt · ★ 178201 repo stars
- [excel-mcp](https://affpapa.org/en/nevibecode/plugins/excel-mcp.md) — plugin · ★ 2 repo stars
- [excel-cli](https://affpapa.org/en/nevibecode/plugins/excel-cli.md) — plugin · ★ 2 repo stars
- [gws-sheets](https://affpapa.org/en/nevibecode/skills/gws-sheets.md) — skill · 61900 installs

From the same set: [genspark-ai/genoffice](https://affpapa.org/en/nevibecode/by/genspark-ai/genoffice.md) — 65 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
