Skip to content

TypeScript and Python clients for the spreadsheet API

Both clients call public operations by operationId. They provide typed results and errors, revision-bound iteration, and polling for file jobs.

Download Node.js and TypeScript or Python. Install the archive with npm install ./duoshao-workbook-typescript-0.1.0.tgz or pip install ./duoshao-workbook-0.1.0.tar.gz. Use Node.js 22+ or Python 3.9+.

import { WorkbookClient } from '@duoshao/workbook-sdk';
const client = new WorkbookClient({ key: process.env.DUOSHAO_API_KEY! });
const book = await client.request('getWorkbook');
import os
from duoshao_workbook import WorkbookClient
client = WorkbookClient(key=os.environ['DUOSHAO_API_KEY'])
book = client.request('getWorkbook')

Pass path variables as path, URL parameters as query, and JSON or file bytes as body. An import takes idempotencyKey and contentType in TypeScript, or idempotency_key and content_type in Python. See all operation names and schemas in OpenAPI.

Use server-side code or a local script. The clients keep the key in an authorization header and do not follow redirects. Reads and operations with stable idempotency keys retry network failures, 429 and 503 up to three attempts by default. The request body and If-Match stay fixed. rows keeps a single revision, and changes keeps a fixed until and reports reset. waitJob or wait_job checks up to 30 times at two-second intervals by default. Downloads return Uint8Array or bytes, with a 16 MiB response limit.

WorkbookError carries an HTTP status, code, revision and retry delay where available. If a write reports unknownOutcome or unknown_outcome, retain the original idempotency key and parameters. A failed job reports its own error code. For poll_timeout, keep the job ID to check later. Cancelling the client wait does not cancel the server job.