Action button
What it is
Section titled “What it is”An action sends a request to your program’s address, either from a button in the spreadsheet header or by itself after edits to the spreadsheet. This way the spreadsheet starts a website build or tells a program that the data has changed. Cell values are not included in the request, only which event, spreadsheet, sheet and revision. The program reads the rows it needs itself with an access key.
How to use it
Section titled “How to use it”Set up an action
Section titled “Set up an action”Actions are set up by the spreadsheet owner. In the header, click the gear icon Actions (on a phone, it is in More); while there are no actions, the window has a single New action button. On the left are the fields in order; on the right, what will be sent and the log.
- Name is the label on the button, for example Publish.
- Trigger: Button runs on a click; People’s edits runs after edits by people, including guests by link, but not by access keys; Any edits runs after any edits, including edits by keys.
- Sheet: for a button, it is visible only on this sheet; for a trigger by edits, only edits on this sheet count. Whole spreadsheet means any sheet. The current sheet is selected at first.
- Address is the https address of your program on the internet.
- Headers: one
Name: valueper line, for exampleAuthorization: Bearer …. Empty means no headers of your own. - Body: empty means the standard body is sent (below). Your own body is JSON with the placeholders
{{requestId}},{{revision}},{{workbookId}},{{sheetId}},{{sentAt}},{{event}},{{fromRevision}}. A value is inserted as is, and you put the quotes around it yourself:"{{requestId}}". - Will be sent on the right shows the whole request right away: the method and address, the reserved headers, your headers (values hidden as “…”) and the body with samples in place of the placeholders. An error appears under its own field, and Create action stays inactive until it is fixed.
- Click Create action. Signing secret appears, marked Shown only now: with the Copy icon, pass the secret to the receiving program and click Hide secret. It cannot be shown again: if you lose it, delete the action and create it anew.
Each action in the list shows its trigger, the site from its address and its sheet or Whole spreadsheet. The pencil Edit action “…” opens the form: saved headers are not shown, you see Headers: N and Replace headers; Save saves. On the right is Runs: the last 20, with the date, time, who clicked (for a trigger by edits, Edit) and the outcome: Sending, Delivered or Not delivered · Code 401. The Test button above the log sends a test run at once, without waiting for a click or an edit. The trash icon Delete action “…” deletes the action immediately, without confirmation.
List of actions
Section titled “List of actions”Next to the name of an action is the outcome of its last run: Sending, Sent 14:32 or Not delivered · Code 405; for a trigger by edits that has stopped, Paused and a Resume button. On a phone, the outcome is a second line under the name.
The owner decides here what is visible in the header:
- Buttons in the header above the list (present when the spreadsheet has at least one action with the Button trigger). Off means no action buttons in the header for anyone; the owner keeps the gear icon Actions.
- Show “…” in the header is a switch in the row of each action with the Button trigger, in a column under the general one. Off means this action has no button in the header, while the action itself stays in the list and works. Actions triggered by edits have no such switch.
- While Buttons in the header is off, the switches in the rows are unavailable, but the choice for each action is kept and comes back when the buttons are turned on again.
- A switch takes effect at once. If saving fails, it goes back and Couldn’t save appears.
Only the owner runs a hidden action: Test in the edit form.
Click the button
Section titled “Click the button”Buttons exist only for actions with the Button trigger that the owner has not hidden in the Actions window. The owner and editors see them; viewers and guests by link do not. Next to the button is Sending (the button is inactive), Sent 14:32 (success, with the time of the answer), Not delivered · Code 401 or Not delivered · No connection. The last state is visible after the page reloads too.
Trigger by edits
Section titled “Trigger by edits”A run is sent after 10 seconds of quiet following the last edit; with continuous editing, no later than 60 seconds after the first unsent edit. While a run is on its way, new edits wait and go with the next one. Edits made before the action was created or before its settings were saved are not sent. Editors do not see such actions.
If the program has not accepted 10 runs by edits in a row, the trigger stops: the action in the list shows Paused and a Resume button. After Resume, only new edits are sent; what was missed during the pause is not. A successful delivery resets the failure count; Test runs do not count.
What the program receives
Section titled “What the program receives”A POST request to Address with the headers from the settings and these:
Content-Type: application/jsonUser-Agent: DUOSHAO-Action/1X-Duoshao-Event: action.run # for a trigger by edits: workbook.changedX-Duoshao-Request-Id: 3f2c9a6e-0b1d-4c55-9f0a-2d8e7b6c1a90X-Duoshao-Signature: sha256=<64 hexadecimal characters>The standard body comes as a single line:
{"event":"action.run","requestId":"3f2c9a6e-0b1d-4c55-9f0a-2d8e7b6c1a90","sentAt":"2026-11-13T10:32:05.123Z", "action":{"id":"…","name":"Publish"},"workbook":{"id":"…","title":"Catalog","revision":412},"sheet":{"id":"…","title":"Products"}}A trigger by edits: "event":"workbook.changed", revision is the revision after the edits, and "fromRevision":409 is added: the revision up to which edits have already been sent; sheet is the action’s sheet, and null for Whole spreadsheet, including with Test. The program reads what exactly has changed with a key.
requestId(the same asX-Duoshao-Request-Id) is one per run and all its retries: discard a request whoserequestIdyou have already processed.sentAtis the time of this attempt; for a button,revisionis the revision at the moment of the click, andsheetis the button’s sheet, and for Whole spreadsheet the sheet where it was clicked.{{fromRevision}}for a button equals{{revision}}; for Test in an action triggered by edits, too.- Answer
2xxwithin 10 seconds and do long work after answering.
Verify the signature
Section titled “Verify the signature”X-Duoshao-Signature is sha256= followed by the HMAC-SHA256 of the body bytes in hexadecimal; the key is the whole secret string dss_…. Compute the signature over the body exactly as it arrived, before parsing the JSON.
// Node.js (Express)import crypto from 'node:crypto';import express from 'express';const secret = process.env.DUOSHAO_ACTION_SECRET; // dss_…const app = express();app.post('/hooks/publish', express.raw({ type: 'application/json' }), (req, res) => { const expected = Buffer.from('sha256=' + crypto.createHmac('sha256', secret).update(req.body).digest('hex')); const got = Buffer.from(req.get('X-Duoshao-Signature') ?? ''); if (got.length !== expected.length || !crypto.timingSafeEqual(got, expected)) return res.sendStatus(401); const event = JSON.parse(req.body.toString('utf8')); res.sendStatus(204); // answer first, work afterwards publish(event).catch(console.error); // your build});# Python (Flask)import hashlib, hmac, osfrom flask import Flask, abort, requestSECRET = os.environ["DUOSHAO_ACTION_SECRET"].encode() # dss_…app = Flask(__name__)
@app.post("/hooks/publish")def publish(): body = request.get_data() expected = ("sha256=" + hmac.new(SECRET, body, hashlib.sha256).hexdigest()).encode() if not hmac.compare_digest(expected, request.headers.get("X-Duoshao-Signature", "").encode()): abort(401) event = request.get_json() return "", 204Example: starting GitHub Actions
Section titled “Example: starting GitHub Actions”Address: https://api.github.com/repos/OWNER/REPOSITORY/actions/workflows/publish.yml/dispatches. Headers: a GitHub token with write permission for Actions in this repository: Authorization: Bearer github_pat_…, Accept: application/vnd.github+json, X-GitHub-Api-Version: 2022-11-28 (each on its own line). Body: {"ref":"main","inputs":{"request_id":"{{requestId}}","revision":"{{revision}}","sheet":"{{sheetId}}"}}. In the workflow, every placeholder is declared as an input, otherwise GitHub answers 422:
on: workflow_dispatch: inputs: request_id: { type: string, required: true } revision: { type: string, required: true } sheet: { type: string, required: true }GitHub answers 204, and the button shows Sent …. GitHub does not verify the signature: the request is protected by the token in Headers.
Limitations
Section titled “Limitations”- Up to 5 actions per spreadsheet. A name is up to 40 characters, an address up to 2000, up to 10 headers (a name up to 100 characters, a value up to 2000), a body up to 16,000 characters.
- The address is https on the internet only: no login and password in the address, not localhost and not an internal network. Your headers do not replace the reserved ones: Host, Content-Type, Content-Length, User-Agent, Connection and the like, as well as X-Duoshao-*.
- While a run is Sending, a second one is not sent. Click the button and Test no more often than once every 10 seconds and 60 times an hour per action. A trigger by edits runs after 10 seconds of quiet, at least once every 60 seconds with continuous editing; it pauses after 10 failures in a row.
- We wait 10 seconds for an answer. With no connection or a 5xx or 429 answer, there are more attempts after pauses of 2 and 8 seconds, 3 in total. A 4xx answer is Not delivered right away, with no retries. Redirects are not followed: a 3xx answer is Not delivered with its code. The program’s answer is not stored and is not read beyond 1 KB.
If something goes wrong
Section titled “If something goes wrong”| What you see | Why | What to do |
|---|---|---|
| A name is required | The name is empty | Enter a name |
| Choose a trigger | The trigger is not chosen or is unknown | Choose Button, People’s edits or Any edits |
| Only an https address on the internet | The address is not https, is internal, has a login, or the name cannot be resolved | Give a public https address |
| A header line is “Name: value”, no reserved headers | No colon, a space in the name, a reserved or repeated header | Fix the line |
| The body must be JSON after substitution | The body is not JSON, for example a placeholder without quotes where a string is needed | Put the placeholder in quotes |
| Sheet not found | The sheet was deleted | Choose another sheet or Whole spreadsheet |
| No more than 5 actions | The spreadsheet already has 5 actions | Delete an unneeded one |
| Couldn’t save, Couldn’t delete, Couldn’t resume | Connection failure; a display switch has gone back to where it was | Try again |
| Already sending | The previous run is still on its way | Wait for the outcome |
| Try again in N s | More often than once every 10 seconds, or more than 60 times in an hour | Wait |
| Couldn’t start | Connection failure on a click or Test | Click again |
| Not delivered · Code 401 (403, 404, 422…) | The program rejected the request | Check the address, the token in Headers and the body |
| Not delivered · Code 301 (302, 307, 308) | The address redirects | Give the final address |
| Not delivered · Code 500 (502, 503, 429) | The program answered with an error on all 3 attempts | Fix the receiving program |
| Not delivered · No connection | 3 attempts with no answer within 10 seconds, or the address is unreachable | Check that the address is open from the internet |
| Not delivered · The action settings are damaged | The secret or the headers could not be read | Delete the action and create it anew |
| Paused | 10 runs by edits in a row were not delivered | Fix the receiver, Test, then Resume |
| No button | You are a viewer or a guest; the action is on another sheet or has a trigger by edits; the owner hid the button or turned off Buttons in the header | Contact the spreadsheet owner |
