Loading...
Loading...
GSheet-CRUD API 使用指南。将 Google Sheets 作为 RESTful API 数据库。当用户需要通过 API 操作 Google Sheets 数据时使用此技能,包括:查询数据(GET)、插入数据(POST)、更新数据(PUT)、删除数据(DELETE)。
npx skill4agent add vkboo/gsheet-crud gsheet-crudgsheett-younami@woven-fountain-458301-p7.iam.gserviceaccount.com| name | age | |
|---|---|---|
| John | 25 | john@example.com |
| Jane | 30 | jane@example.com |
https://gsheet.codingfor.fun/api/{doc_id}/{sheet_name}doc_idhttps://docs.google.com/spreadsheets/d/{doc_id}/editsheet_nameSheet1curl 'https://gsheet.codingfor.fun/api/{doc_id}'curl 'https://gsheet.codingfor.fun/api/{doc_id}?name=John&age=25'[
{"name": "John", "age": 25, "email": "john@example.com"}
]curl -X POST 'https://gsheet.codingfor.fun/api/{doc_id}' \
-H 'Content-Type: application/json' \
-d '{"name": "Mike", "age": 28, "email": "mike@example.com"}'curl -X POST 'https://gsheet.codingfor.fun/api/{doc_id}' \
-H 'Content-Type: application/json' \
-d '[
{"name": "Mike", "age": 28, "email": "mike@example.com"},
{"name": "Sarah", "age": 35, "email": "sarah@example.com"}
]'curl -X PUT 'https://gsheet.codingfor.fun/api/{doc_id}?name=John' \
-H 'Content-Type: application/json' \
-d '{"age": 26, "email": "new_email@example.com"}'curl -X DELETE 'https://gsheet.codingfor.fun/api/{doc_id}?name=John'const API_BASE = 'https://gsheet.codingfor.fun/api';
const DOC_ID = 'your_doc_id';
// 查询
const data = await fetch(`${API_BASE}/${DOC_ID}?name=John`).then(r => r.json());
// 插入
await fetch(`${API_BASE}/${DOC_ID}`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ name: 'Mike', age: 28, email: 'mike@example.com' })
});
// 更新
await fetch(`${API_BASE}/${DOC_ID}?name=John`, {
method: 'PUT',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ age: 26 })
});
// 删除
await fetch(`${API_BASE}/${DOC_ID}?name=John`, { method: 'DELETE' });import requests
API_BASE = 'https://gsheet.codingfor.fun/api'
DOC_ID = 'your_doc_id'
# 查询
data = requests.get(f'{API_BASE}/{DOC_ID}', params={'name': 'John'}).json()
# 插入
requests.post(f'{API_BASE}/{DOC_ID}', json={'name': 'Mike', 'age': 28, 'email': 'mike@example.com'})
# 更新
requests.put(f'{API_BASE}/{DOC_ID}', params={'name': 'John'}, json={'age': 26})
# 删除
requests.delete(f'{API_BASE}/{DOC_ID}', params={'name': 'John'})