create_sheet
Add a new sheet to an existing Google Spreadsheet by specifying the spreadsheet ID and desired sheet name.
Instructions
新しいシートを作成します
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| spreadsheetId | Yes | スプレッドシートのID | |
| sheetName | Yes | 作成するシート名 |
Implementation Reference
- src/index.ts:309-336 (handler)The core handler function that executes the creation of a new sheet in the specified Google Spreadsheet using the Google Sheets API's batchUpdate method with an addSheet request.async function createSheet(spreadsheetId: string, sheetName: string) { const authClient = await auth.getClient(); const sheets = google.sheets({ version: "v4", auth: authClient as any }); const response = await sheets.spreadsheets.batchUpdate({ spreadsheetId, requestBody: { requests: [ { addSheet: { properties: { title: sheetName, }, }, }, ], }, }); return { content: [ { type: "text", text: `シート "${sheetName}" が正常に作成されました。`, }, ], }; }
- src/index.ts:123-140 (schema)Defines the tool schema for 'create_sheet', including the name, description, and inputSchema with required parameters spreadsheetId (string) and sheetName (string). This is part of the tools array used for tool listing.{ name: "create_sheet", description: "新しいシートを作成します", inputSchema: { type: "object", properties: { spreadsheetId: { type: "string", description: "スプレッドシートのID", }, sheetName: { type: "string", description: "作成するシート名", }, }, required: ["spreadsheetId", "sheetName"], }, },
- src/index.ts:180-182 (registration)The switch case in the main CallToolRequestSchema handler that registers and dispatches the 'create_sheet' tool call to the createSheet function.case "create_sheet": return await createSheet(args.spreadsheetId as string, args.sheetName as string);