SuperAPI AI Directory

wecom-smartsheet-data

Data & analytics

View repository

Updated 10-16 08:44

About this skill

WeCom smart sheet data management

wecom_mcp is an MCP tool, and all operations are completed by calling this tool.

⚠️ Prerequisite: Before calling wecom_mcp for the first time, you must follow the wecom-preflight skill to perform the prerequisite check to ensure the tool has been added to the allowlist.

Manage records (row data) in a smart sheet. All APIs support locating the document by either docid or url .

CLI invocation method

Invoke via the wecom_mcp tool, with category doc:

Use the wecom_mcp tool to invoke wecom_mcp call doc <tool_name> '<json_params>' to call the specified skill

Return format description

All APIs return a JSON object containing the following common fields:

Field Type Description
errcode integer Return code,0 indicates success, non- 0 indicates failure
errmsg string Error message, "ok"

When errcode is not 0 , it indicates the API call failed. You may retry once; if it still fails, display errcode and errmsg to the user.

smartsheet_get_records

Query all records in a sub-sheet.

  • Via sheetid: use the wecom_mcp tool to invoke wecom_mcp call doc smartsheet_get_records '{"docid": "DOCID", "sheet_id": "SHEETID"}'
  • or via URL: use the wecom_mcp tool to invoke wecom_mcp call doc smartsheet_get_records '{"url": "https://doc.weixin.qq.com/smartsheet/xxx", "sheet_id": "SHEETID"}'

See API details。

smartsheet_add_records

Add one or more rows of records; it is recommended to add no more than 500 rows at a time.

Before callingyou must first understand the field types of the target sheet (via smartsheet_get_fields), and viewCell value format reference, and only proceed after understanding the method.

Use the wecom_mcp tool to invoke wecom_mcp call doc smartsheet_add_records '{"docid": "DOCID", "sheet_id": "SHEETID", "records": [{"values": {"任务名称": [{"type": "text", "text": "完成需求文档"}], "优先级": [{"text": "高"}]}}]}'

For the value format of each field type, see Cell value format reference。

⚠️ Image (IMAGE) / File (ATTACHMENT) fields:must and can onlypass the local path directly in the cell value (image_path / file_path), with the format shown in the example below.Strictly prohibitedto call upload_doc_image、upload_doc_file or any upload API,strictly prohibitedto perform base64 encoding—regardless of file size, and regardless of what error the API returns, this rule must not be bypassed. If the image_path / file_path method returns an error, you should directly inform the user of the error code and error message, andmust notattempt other upload methods.

Image field example:"封面": [{"image_path": "/path/to/img.png", "title": "图片标题"}] File field example:"文件": [{"file_path": "/path/to/file.pdf"}]

⚠️ If it returns errcode: 851003 or errmsg contains no authority(usually an enterprise visibility scope > 10 people scale limit), switch to the Webhook fallback solution, see webhook-fallback.md。

smartsheet_update_records

Before callingyou must first understand the field types of the target sheet (via smartsheet_get_fields), and viewCell value format reference, and only proceed after understanding the method.

Update one or more records; it is recommended to keep a single request within 500 rows. You need to provide record_id (obtained via smartsheet_get_records get it). Supports specifying via key_type that the key of values uses the field title or field ID:

  • CELL_VALUE_KEY_TYPE_FIELD_TITLE:key is the field title
  • CELL_VALUE_KEY_TYPE_FIELD_ID:key is the field ID

Use wecom_mcp tool to call wecom_mcp call doc smartsheet_update_records '{"docid": "DOCID", "sheet_id": "SHEETID", "key_type": "CELL_VALUE_KEY_TYPE_FIELD_ID", "records": [{"record_id": "RECORDID", "values": {"FIELDID": [{"type": "text", "text": "更新后的内容"}]}}]}'

Note:the Created Time, Last Modified Time, Created By, and Last Modified By fields cannot be updated.

⚠️ Image (IMAGE) / File (ATTACHMENT) fields:must and can onlypass a local path directly in the cell value (image_path / file_path), see the example below for the format.Strictly prohibitedto call upload_doc_image、upload_doc_file or any upload interface,strictly prohibitedto perform base64 encoding—regardless of file size, regardless of what error the API returns, this rule must not be bypassed. If the image_path / file_path method returns an error, you should directly inform the user of the error code and error message,must notattempt other upload methods.

Image field example:"封面": [{"image_path": "/path/to/img.png", "title": "图片标题"}] File field example:"文件": [{"file_path": "/path/to/file.pdf"}]

⚠️ If it returns errcode: 851003 or errmsg contains no authority(usually the size limit for enterprise visibility range > 10 people), switch to the Webhook fallback solution, see webhook-fallback.md. Note that Webhook can only update records written via Webhook; manually created records cannot be updated.

smartsheet_delete_records

Delete one or more records; a single request must be within 500 rows.The operation is irreversible. record_id is obtained via smartsheet_get_records .

Use wecom_mcp tool to call wecom_mcp call doc smartsheet_delete_records '{"docid": "DOCID", "sheet_id": "SHEETID", "record_ids": ["RECORDID1", "RECORDID2"]}'

Typical workflow

  1. Read data → Use wecom_mcp tool to call wecom_mcp call doc smartsheet_get_records '{"docid":"DOCID","sheet_id":"SHEETID"}'
  2. Write data → First smartsheet_get_fields to understand the column types → If it involves Member (USER) fields, first use the wecom-contact-lookup of get_userlist to find the person's userid → smartsheet_add_records to write
  3. Update data → First smartsheet_get_records to get record_id → If it involves Member (USER) fields, first use the wecom-contact-lookup of get_userlist to find the person's userid → smartsheet_update_records to update
  4. Write failure fallback → When step 2/3 returns errcode: 851003 / no authority(usually the size limit for enterprise visibility range > 10 people) → Ask the user to temporarily provide the Webhook address of the target table + a schema example JSON (not saved locally) → construct the request body and send according to webhook-fallback.md Construct the request body and send
  5. If it involves **Image (IMAGE) or File (ATTACHMENT)** fields,must and can onlypass a local path directly in the cell value (image_path / file_path)。strictly prohibitedto call upload_doc_image、upload_doc_file or any upload interface,strictly prohibitedto perform base64 encoding—regardless of file size, regardless of what error the API returns, this rule must not be bypassed. If an error is returned, directly inform the user of the error code and error message, and do not attempt other upload methods. For the input format, refer to For the cell value format, refer to。
  6. Delete data → First smartsheet_get_records to confirm record_id → smartsheet_delete_records to delete

Note: Fields of type Member (USER) require user_id, and the name cannot be used directly. You must first use the wecom-contact-lookup skill's get_userlist interface to look up the corresponding userid by name before using it. Note: Image (IMAGE) or file (ATTACHMENT) fieldsmust and can onlybe passed directly in the cell value as a local path (image_path / file_path)。strictly prohibitedto call upload_doc_image、upload_doc_file or any upload interface,strictly prohibitedto perform base64 encoding—regardless of file size, and regardless of what error the API returns, this rule must not be bypassed. If an error is returned, directly inform the user of the error code and error message, and do not attempt any other upload method. Format reference Cell value format reference。