> ## Documentation Index
> Fetch the complete documentation index at: https://docs.automate.ax/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Automate.ax automations are TypeScript programs.
> Use Bun for installation and command examples.
> Use Automate.ax for the product name and automate.ax for the package, CLI, and domain.
> Treat documented public APIs as current; do not invent transitional or deprecated names.

# Write values

> Write one or more Google Sheets value ranges atomically.

`writeValues` replaces cell values in one or several A1 or named ranges in one
atomic value request.

## Example

```ts theme={null}
import { automation, onHttpRequest } from "automate.ax"
import { writeValues } from "automate.ax/google-sheets"

export default automation("Write an order summary", () => {
  onHttpRequest({ scope: "automation" })

  writeValues({
    spreadsheet: "spreadsheet-id",
    inputMode: "userEntered",
    includeValues: true,
    updates: [
      {
        range: "Summary!A1:B2",
        values: [
          ["Orders", 42],
          ["Total", "=SUM(Orders!D:D)"],
        ],
      },
    ],
  })
})
```

## Inputs

`spreadsheet` and one update or non-empty update array are required. Each update
contains `range`, `values`, and optional `majorDimension: "rows" | "columns"`
(default rows). Cell values are string, number, boolean, or `null`; null clears
the cell. `inputMode` defaults to `userEntered`, which parses formula-looking
strings and other UI input; `raw` stores strings literally. `includeValues`
defaults to false. Optional `responseValueRender` and `responseDateTimeRender`
use the modes from [Read values](/reference/integrations/google-sheets/actions/read-values#inputs).

`account` optionally selects the Google account binding.

## Output

Returns spreadsheet ID, total updated cells/rows/columns/sheets, and an
`updates` array with `updatedRange`, counts, and optional returned `{ range,
majorDimension, values }`. Returned values appear only when `includeValues` is
true.
