Google Sheets Skill
Write and read data from Google Sheets using gspread library.
Default Spreadsheet
Spreadsheet ID: 1r_Q1S-zF8meqYVGkAv30dtI4_qePbDesSh5HCeuYcf0
URL: https://docs.google.com/spreadsheets/d/1r_Q1S-zF8meqYVGkAv30dtI4_qePbDesSh5HCeuYcf0/edit
Esta es la spreadsheet principal usada por Clawd para tareas de Jona. Usa este spreadsheet_id como default en todas las operaciones salvo que se indique lo contrario.
Setup
Prerequisites
- •Create a Google Cloud project
- •Enable Google Sheets API
- •Create a Service Account and download credentials JSON
- •Share your spreadsheet with the service account email
Credentials
Store credentials at: ~/.config/google/credentials.json
json
{
"type": "service_account",
"project_id": "your-project-id",
"private_key": "-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n",
"client_email": "your-sa@project.iam.gserviceaccount.com",
...
}
Usage
Write Data
python
from google-sheets import write_to_sheet
# Usando spreadsheet default
write_to_sheet(
sheet_name="Sheet1",
data=[["Header1", "Header2"], ["Value1", "Value2"]]
)
# Con spreadsheet específico
write_to_sheet(
spreadsheet_id="other-sheet-id",
sheet_name="Sheet1",
data=[["Header1", "Header2"], ["Value1", "Value2"]]
)
Read Data
python
from google-sheets import read_from_sheet
# Usando spreadsheet default
data = read_from_sheet(
sheet_name="Sheet1",
range="A1:B10"
)
Create New Sheet
python
from google-sheets import create_sheet
create_sheet(
title="NewSheetName",
rows=100,
cols=26
)
API
write_to_sheet(spreadsheet_id, sheet_name, data)
Write a 2D list of data to the specified range.
read_from_sheet(spreadsheet_id, sheet_name, range="A1:Z100")
Read data from specified range.
create_sheet(spreadsheet_id, title, rows=100, cols=26)
Create a new worksheet.
list_sheets(spreadsheet_id)
List all worksheets in a spreadsheet.