SuperAPI AI Directory

wecom-smartsheet-api

Coding & development

View repository

Updated 10-15 17:29

About this skill

WeCom Smart Sheet — Backend API (Read-Only)

Via the dop-api/opendoc API, smart sheet data is obtained directly without relying on browser JS memory.

Cookie Acquisition

Priority: automatic extraction > environment variables > command-line arguments

Method 1: Automatic extraction from the browser (recommended)

Prerequisite: the browser is already logged in to WeCom Docs (any WeCom Docs page open is sufficient).

// 在 browser evaluate 中执行
() => document.cookie

Method 2: Environment variables

export WECOM_COOKIE="utype=ww; TOK=xxx; wedoc_sid=xxx; wedoc_skey=xxx; wedoc_ticket=xxx; ..."

Method 3: Command-line arguments

node scripts/fetch-smartsheet.mjs <url> "<cookie-string>"

Method 4: User provides manually

Guide the user to obtain the Cookie in the browser:

  1. Open any WeCom Docs page in the browser (such as a smart sheet)
  2. Press F12 to open Developer Tools
  3. Switch to the "Console" tab
  4. Enter document.cookie and press Enter
  5. Copy the entire output text

Or via the "Network" panel:

  1. Open Developer Tools → Network tab
  2. Refresh the page
  3. Click any doc.weixin.qq.com request
  4. Find the Cookie field in Headers and copy the complete value

Key Cookie fields

Field Purpose Required
wedoc_sid Session ID ✅
wedoc_skey Session key ✅
wedoc_ticket Authentication ticket ✅
TOK XSRF token ✅
tdoc_uid User ID ✅
utype User type (ww = WeCom) Recommended
wedoc_sids Multi-session identifier Recommended

The simplest approach is to copy the complete document.cookie output; there is no need to manually select fields.

The Cookie validity period depends on the WeCom login state, usually from several hours to several days. Expiration manifests as the API returning a login page or 403.

Usage

# 读取表格(自动分页)
node scripts/fetch-smartsheet.mjs <smartsheet-url>

# 只读前 10 行
WECOM_ENDROW=10 node scripts/fetch-smartsheet.mjs <url>

# 调试模式(输出原始 JSON)
DEBUG=1 node scripts/fetch-smartsheet.mjs <url>

Environment variables

Variable Default value Description
WECOM_COOKIE - Cookie string
WECOM_STARTROW 0 Start row
WECOM_ENDROW - End row (when set, only a single page is requested)
WECOM_PAGE_SIZE 500 Automatic pagination size

API details

Core API:GET https://doc.weixin.qq.com/dop-api/opendoc

For data format details, see references/snapshot-format.md。