Google Sheets: Create spreadsheet
Creates a new spreadsheet in the connected account’s Drive and returns its id and address.
- Kind:
google-sheets.create_spreadsheet - Palette: Integrations, under Google Sheets
- Credential: a credential of kind
bearer, named incredential - Other Google Sheets actions: Read rows as objects, Append rows, Update or append a row by key, Read range, Update range, Clear range, Get spreadsheet details, Add sheet
When to use
Section titled “When to use”- A fresh spreadsheet per report, per customer or per month.
- Setting up a sheet for a workflow’s first run, with its tabs named up front.
This action takes no spreadsheet_id. Every run creates another spreadsheet, and so can a step
run a second time after Google made the first (a retry: after a lost answer, or an agent that
lost its lease). Put it where a run reaches it once.
Connection (with)
Section titled “Connection (with)”This action takes no with.
Input (input)
Section titled “Input (input)”| Field | Type | Required | Description |
|---|---|---|---|
title |
string | yes | The new spreadsheet’s name. It goes in the connected account’s Drive. |
sheets |
array of string | no | Names for its sheets (tabs), in order, e.g. [“Orders”, “Summary”]. Empty: one sheet, Sheet1. Default []. |
Settings
Section titled “Settings”Beside with and input in the node’s config.
| Field | Type | Required | Description |
|---|---|---|---|
credential |
string | yes | Name of the project credential the action authenticates with. |
fail_on_error_status |
boolean | no | Treat any 4xx/5xx as a failure. On by default: an action either did its job or did not. Default true. |
optional_when_untrusted |
boolean | no | Run without the credential when the run is untrusted (a fork pull request), instead of failing. The credential is still withheld. |
retry_on |
array | no | Status codes that fail the node instead of returning, so its retry: policy applies (e.g. [429, 503]). |
Output
Section titled “Output”The HTTP response. The reply is under body: nodes.<id>.output.body.<field>.
| Field | Type | Description |
|---|---|---|
status |
integer | The HTTP status code. |
headers |
object | The response headers. |
body |
object | The response body, parsed as JSON when it is JSON. |
body.properties |
object | |
body.properties.title |
string | |
body.sheets |
array | One entry per sheet, each with properties.title and properties.sheetId. |
body.spreadsheetId |
string | The new spreadsheet’s id, for the spreadsheet field of the steps that use it. |
body.spreadsheetUrl |
string | Its address, to open it in a browser. |
How it runs
Section titled “How it runs”- On an agent with the
connectorcapability. The managed environments have one, so this needs no agent of your own. - One
POSTrequest tosheets.googleapis.com. - Any 4xx or 5xx fails the step, unless
fail_on_error_statusisfalse.retry:asks again after a 5xx, a 401, 408, 409, 423, 425 or 429, or a 4xx withRetry-After, and not after any other 4xx, which would get the same answer. 429waited out and asked again with backoff, with noretry:on the step.
Example
Section titled “Example”version: hyperspool-graph/v1nodes: - id: create type: google-sheets.create_spreadsheet config: credential: sheets input: title: { $template: "Orders {{ input.month }}" } sheets: [Orders, Summary] - id: header type: google-sheets.update_range config: credential: sheets with: spreadsheet_id: { $expr: "nodes.create.output.body.spreadsheetId" } input: range: Orders!A1 values: [[order_id, customer, total, status]]edges: - { from: create, to: header }The new id is at nodes.<id>.output.body.spreadsheetId, ready for the spreadsheet_id of the
steps below, and its address at body.spreadsheetUrl.
See Connectors for credentials and versions, and the node reference for every other node.