@squadbase/vite-server 0.1.3-dev.11 → 0.1.3-dev.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -90,13 +90,13 @@ var parameters = {
90
90
  envVarBaseKey: "GOOGLE_SHEETS_OAUTH_SPREADSHEET_URL",
91
91
  type: "text",
92
92
  secret: false,
93
- required: true
93
+ required: false
94
94
  })
95
95
  };
96
96
 
97
97
  // ../connectors/src/connectors/google-sheets-oauth/sdk/index.ts
98
98
  init_utils2();
99
- var BASE_URL = "https://sheets.googleapis.com/v4/spreadsheets";
99
+ var SHEETS_BASE_URL = "https://sheets.googleapis.com/v4/spreadsheets";
100
100
  function createClient(params, fetchFn = fetch) {
101
101
  const spreadsheetUrl = params[parameters.spreadsheetUrl.slug];
102
102
  const defaultSpreadsheetId = spreadsheetUrl ? extractSpreadsheetId(spreadsheetUrl) : void 0;
@@ -111,12 +111,12 @@ function createClient(params, fetchFn = fetch) {
111
111
  }
112
112
  function request(path2, init) {
113
113
  const resolvedPath = defaultSpreadsheetId ? path2.replace(/\{spreadsheetId\}/g, defaultSpreadsheetId) : path2;
114
- const url = `${BASE_URL}${resolvedPath.startsWith("/") ? "" : "/"}${resolvedPath}`;
114
+ const url = `${SHEETS_BASE_URL}${resolvedPath.startsWith("/") ? "" : "/"}${resolvedPath}`;
115
115
  return fetchFn(url, init);
116
116
  }
117
117
  async function getSpreadsheet(spreadsheetId) {
118
118
  const id = resolveSpreadsheetId(spreadsheetId);
119
- const url = `${BASE_URL}/${id}?fields=spreadsheetId,properties,sheets.properties`;
119
+ const url = `${SHEETS_BASE_URL}/${id}?fields=spreadsheetId,properties,sheets.properties`;
120
120
  const response = await fetchFn(url);
121
121
  if (!response.ok) {
122
122
  const body = await response.text();
@@ -128,7 +128,7 @@ function createClient(params, fetchFn = fetch) {
128
128
  }
129
129
  async function getValues(range, spreadsheetId) {
130
130
  const id = resolveSpreadsheetId(spreadsheetId);
131
- const url = `${BASE_URL}/${id}/values/${encodeURIComponent(range)}`;
131
+ const url = `${SHEETS_BASE_URL}/${id}/values/${encodeURIComponent(range)}`;
132
132
  const response = await fetchFn(url);
133
133
  if (!response.ok) {
134
134
  const body = await response.text();
@@ -144,7 +144,7 @@ function createClient(params, fetchFn = fetch) {
144
144
  for (const range of ranges) {
145
145
  searchParams.append("ranges", range);
146
146
  }
147
- const url = `${BASE_URL}/${id}/values:batchGet?${searchParams.toString()}`;
147
+ const url = `${SHEETS_BASE_URL}/${id}/values:batchGet?${searchParams.toString()}`;
148
148
  const response = await fetchFn(url);
149
149
  if (!response.ok) {
150
150
  const body = await response.text();
@@ -154,11 +154,65 @@ function createClient(params, fetchFn = fetch) {
154
154
  }
155
155
  return await response.json();
156
156
  }
157
+ async function updateValues(range, values, spreadsheetId) {
158
+ const id = resolveSpreadsheetId(spreadsheetId);
159
+ const url = `${SHEETS_BASE_URL}/${id}/values/${encodeURIComponent(range)}?valueInputOption=USER_ENTERED`;
160
+ const response = await fetchFn(url, {
161
+ method: "PUT",
162
+ headers: { "Content-Type": "application/json" },
163
+ body: JSON.stringify({ range, majorDimension: "ROWS", values })
164
+ });
165
+ if (!response.ok) {
166
+ const body = await response.text();
167
+ throw new Error(
168
+ `google-sheets: updateValues failed (${response.status}): ${body}`
169
+ );
170
+ }
171
+ return await response.json();
172
+ }
173
+ async function appendValues(range, values, spreadsheetId) {
174
+ const id = resolveSpreadsheetId(spreadsheetId);
175
+ const url = `${SHEETS_BASE_URL}/${id}/values/${encodeURIComponent(range)}:append?valueInputOption=USER_ENTERED&insertDataOption=INSERT_ROWS`;
176
+ const response = await fetchFn(url, {
177
+ method: "POST",
178
+ headers: { "Content-Type": "application/json" },
179
+ body: JSON.stringify({ range, majorDimension: "ROWS", values })
180
+ });
181
+ if (!response.ok) {
182
+ const body = await response.text();
183
+ throw new Error(
184
+ `google-sheets: appendValues failed (${response.status}): ${body}`
185
+ );
186
+ }
187
+ return await response.json();
188
+ }
189
+ async function createSpreadsheet(title, sheetTitles) {
190
+ const sheets = sheetTitles && sheetTitles.length > 0 ? sheetTitles.map((t) => ({ properties: { title: t } })) : void 0;
191
+ const url = `${SHEETS_BASE_URL}`;
192
+ const response = await fetchFn(url, {
193
+ method: "POST",
194
+ headers: { "Content-Type": "application/json" },
195
+ body: JSON.stringify({
196
+ properties: { title },
197
+ ...sheets ? { sheets } : {}
198
+ })
199
+ });
200
+ if (!response.ok) {
201
+ const body = await response.text();
202
+ throw new Error(
203
+ `google-sheets: createSpreadsheet failed (${response.status}): ${body}`
204
+ );
205
+ }
206
+ return await response.json();
207
+ }
157
208
  return {
158
209
  request,
159
210
  getSpreadsheet,
160
211
  getValues,
161
- batchGetValues
212
+ batchGetValues,
213
+ updateValues,
214
+ appendValues,
215
+ createSpreadsheet
162
216
  };
163
217
  }
164
218
 
@@ -275,7 +329,8 @@ var AUTH_TYPES = {
275
329
  // ../connectors/src/connectors/google-sheets-oauth/tools/request.ts
276
330
  import { z } from "zod";
277
331
  init_utils2();
278
- var BASE_URL2 = "https://sheets.googleapis.com/v4/spreadsheets";
332
+ var SHEETS_BASE_URL2 = "https://sheets.googleapis.com/v4/spreadsheets";
333
+ var DRIVE_BASE_URL = "https://www.googleapis.com/drive/v3/files";
279
334
  var REQUEST_TIMEOUT_MS = 6e4;
280
335
  var cachedToken = null;
281
336
  async function getProxyToken(config) {
@@ -313,10 +368,11 @@ var inputSchema = z.object({
313
368
  "Brief description of what you intend to accomplish with this tool call"
314
369
  ),
315
370
  connectionId: z.string().describe("ID of the Google Sheets OAuth connection to use"),
316
- method: z.enum(["GET"]).describe("HTTP method (read-only, GET only)"),
371
+ method: z.enum(["GET", "POST", "PUT"]).describe("HTTP method"),
317
372
  path: z.string().describe(
318
- "API path appended to https://sheets.googleapis.com/v4/spreadsheets (e.g., '/{spreadsheetId}', '/{spreadsheetId}/values/Sheet1!A1:D10'). {spreadsheetId} is automatically replaced if a default is configured."
373
+ "API path appended to https://sheets.googleapis.com/v4/spreadsheets (e.g., '/{spreadsheetId}', '/{spreadsheetId}/values/Sheet1!A1:D10'). Use 'drive://files' prefix for Google Drive API calls (e.g., creating new spreadsheets). {spreadsheetId} is automatically replaced if a default is configured."
319
374
  ),
375
+ body: z.record(z.string(), z.unknown()).optional().describe("JSON request body for POST/PUT requests"),
320
376
  queryParams: z.record(z.string(), z.string()).optional().describe("Query parameters to append to the URL")
321
377
  });
322
378
  var outputSchema = z.discriminatedUnion("success", [
@@ -332,12 +388,13 @@ var outputSchema = z.discriminatedUnion("success", [
332
388
  ]);
333
389
  var requestTool = new ConnectorTool({
334
390
  name: "request",
335
- description: `Send authenticated GET requests to the Google Sheets API v4.
391
+ description: `Send authenticated requests to the Google Sheets API v4.
392
+ Supports GET (read), POST (create/append), and PUT (update) methods.
336
393
  Authentication is handled automatically via OAuth proxy.
337
394
  {spreadsheetId} in the path is automatically replaced with the connection's default spreadsheet ID if configured.`,
338
395
  inputSchema,
339
396
  outputSchema,
340
- async execute({ connectionId, method, path: path2, queryParams }, connections, config) {
397
+ async execute({ connectionId, method, path: path2, body, queryParams }, connections, config) {
341
398
  const connection2 = connections.find((c) => c.id === connectionId);
342
399
  if (!connection2) {
343
400
  return {
@@ -351,8 +408,14 @@ Authentication is handled automatically via OAuth proxy.
351
408
  try {
352
409
  const spreadsheetUrl = parameters.spreadsheetUrl.tryGetValue(connection2);
353
410
  const spreadsheetId = spreadsheetUrl ? extractSpreadsheetId(spreadsheetUrl) : void 0;
354
- const resolvedPath = spreadsheetId ? path2.replace(/\{spreadsheetId\}/g, spreadsheetId) : path2;
355
- let url = `${BASE_URL2}${resolvedPath.startsWith("/") ? "" : "/"}${resolvedPath}`;
411
+ let url;
412
+ if (path2.startsWith("drive://")) {
413
+ const drivePath = path2.slice("drive://".length);
414
+ url = `${DRIVE_BASE_URL}${drivePath.startsWith("/") ? "" : "/"}${drivePath}`;
415
+ } else {
416
+ const resolvedPath = spreadsheetId ? path2.replace(/\{spreadsheetId\}/g, spreadsheetId) : path2;
417
+ url = `${SHEETS_BASE_URL2}${resolvedPath.startsWith("/") ? "" : "/"}${resolvedPath}`;
418
+ }
356
419
  if (queryParams) {
357
420
  const searchParams = new URLSearchParams(queryParams);
358
421
  url += `?${searchParams.toString()}`;
@@ -370,7 +433,8 @@ Authentication is handled automatically via OAuth proxy.
370
433
  },
371
434
  body: JSON.stringify({
372
435
  url,
373
- method
436
+ method,
437
+ ...body != null ? { body: JSON.stringify(body) } : {}
374
438
  }),
375
439
  signal: controller.signal
376
440
  });
@@ -439,7 +503,7 @@ var googleSheetsOauthConnector = new ConnectorPlugin({
439
503
  slug: "google-sheets",
440
504
  authType: AUTH_TYPES.OAUTH,
441
505
  name: "Google Sheets",
442
- description: "Connect to Google Sheets for spreadsheet data access using OAuth.",
506
+ description: "Connect to Google Sheets for spreadsheet data access and creation using OAuth.",
443
507
  iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/1UPQuggyiZmbb26CuaSr2h/032770e8739b183fa00b7625f024e536/google-sheets.svg",
444
508
  parameters,
445
509
  releaseFlag: { dev1: true, dev2: false, prod: false },
@@ -448,22 +512,33 @@ var googleSheetsOauthConnector = new ConnectorPlugin({
448
512
  allowlist: [
449
513
  {
450
514
  host: "sheets.googleapis.com",
451
- methods: ["GET"]
515
+ methods: ["GET", "POST", "PUT"]
516
+ },
517
+ {
518
+ host: "www.googleapis.com",
519
+ methods: ["POST"],
520
+ pathPrefix: "/drive/v3/files"
452
521
  }
453
522
  ]
454
523
  },
455
524
  systemPrompt: {
456
525
  en: `### Tools
457
526
 
458
- - \`google-sheets-oauth_request\`: The only way to call the Google Sheets API (read-only). Use it to get spreadsheet metadata, cell values, and batch values. Authentication is configured automatically via OAuth. The {spreadsheetId} placeholder in paths is automatically replaced with the configured default spreadsheet ID.
527
+ - \`google-sheets-oauth_request\`: The way to call the Google Sheets API. Supports read and write operations. Use it to get/update spreadsheet metadata, cell values, create new spreadsheets, and more. Authentication is configured automatically via OAuth. The {spreadsheetId} placeholder in paths is automatically replaced with the configured default spreadsheet ID.
459
528
 
460
529
  ### Google Sheets API Reference
461
530
 
462
- #### Available Endpoints
531
+ #### Read Endpoints
463
532
  - GET \`/{spreadsheetId}\` \u2014 Get spreadsheet metadata (title, sheets, properties)
464
533
  - GET \`/{spreadsheetId}/values/{range}\` \u2014 Get cell values for a range
465
534
  - GET \`/{spreadsheetId}/values:batchGet?ranges={range1}&ranges={range2}\` \u2014 Get values for multiple ranges
466
535
 
536
+ #### Write Endpoints
537
+ - POST \`\` (empty path, with body) \u2014 Create a new spreadsheet. Body: \`{ "properties": { "title": "My Sheet" }, "sheets": [{ "properties": { "title": "Sheet1" } }] }\`
538
+ - PUT \`/{spreadsheetId}/values/{range}?valueInputOption=USER_ENTERED\` \u2014 Update cell values for a range. Body: \`{ "range": "Sheet1!A1:B2", "majorDimension": "ROWS", "values": [["a","b"],["c","d"]] }\`
539
+ - POST \`/{spreadsheetId}/values/{range}:append?valueInputOption=USER_ENTERED&insertDataOption=INSERT_ROWS\` \u2014 Append rows after the last row. Body: \`{ "range": "Sheet1!A1", "majorDimension": "ROWS", "values": [["a","b"]] }\`
540
+ - POST \`/{spreadsheetId}:batchUpdate\` \u2014 Apply multiple updates (formatting, add sheets, merge cells, etc.). Body: \`{ "requests": [...] }\`
541
+
467
542
  ### Range Notation (A1 notation)
468
543
  - \`Sheet1!A1:D10\` \u2014 Specific range on Sheet1
469
544
  - \`Sheet1!A:A\` \u2014 Entire column A on Sheet1
@@ -477,6 +552,7 @@ var googleSheetsOauthConnector = new ConnectorPlugin({
477
552
  - Use \`valueRenderOption=FORMATTED_VALUE\` query param to get display values
478
553
  - Use \`valueRenderOption=UNFORMATTED_VALUE\` for raw numeric values
479
554
  - Use \`majorDimension=COLUMNS\` to get data organized by columns instead of rows
555
+ - For write operations, always use \`valueInputOption=USER_ENTERED\` so values are parsed as if typed by a user (dates, numbers, formulas are auto-detected)
480
556
 
481
557
  ### Business Logic
482
558
 
@@ -500,18 +576,34 @@ console.log(values.values); // 2D array
500
576
  // Get multiple ranges at once
501
577
  const batch = await sheets.batchGetValues(["Sheet1!A1:B5", "Sheet2!A1:C3"]);
502
578
  batch.valueRanges.forEach(vr => console.log(vr.range, vr.values));
579
+
580
+ // Update cell values
581
+ await sheets.updateValues("Sheet1!A1:B2", [["Name", "Score"], ["Alice", "100"]]);
582
+
583
+ // Append rows
584
+ await sheets.appendValues("Sheet1!A1", [["Bob", "95"], ["Charlie", "88"]]);
585
+
586
+ // Create a new spreadsheet
587
+ const newSheet = await sheets.createSpreadsheet("Sales Report", ["Q1", "Q2", "Q3", "Q4"]);
588
+ console.log(newSheet.spreadsheetId, newSheet.spreadsheetUrl);
503
589
  \`\`\``,
504
590
  ja: `### \u30C4\u30FC\u30EB
505
591
 
506
- - \`google-sheets-oauth_request\`: Google Sheets API\u3092\u547C\u3073\u51FA\u3059\u552F\u4E00\u306E\u624B\u6BB5\u3067\u3059\uFF08\u8AAD\u307F\u53D6\u308A\u5C02\u7528\uFF09\u3002\u30B9\u30D7\u30EC\u30C3\u30C9\u30B7\u30FC\u30C8\u306E\u30E1\u30BF\u30C7\u30FC\u30BF\u3001\u30BB\u30EB\u5024\u3001\u30D0\u30C3\u30C1\u5024\u306E\u53D6\u5F97\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002OAuth\u7D4C\u7531\u3067\u8A8D\u8A3C\u306F\u81EA\u52D5\u8A2D\u5B9A\u3055\u308C\u307E\u3059\u3002\u30D1\u30B9\u5185\u306E{spreadsheetId}\u30D7\u30EC\u30FC\u30B9\u30DB\u30EB\u30C0\u30FC\u306F\u8A2D\u5B9A\u6E08\u307F\u306E\u30C7\u30D5\u30A9\u30EB\u30C8\u30B9\u30D7\u30EC\u30C3\u30C9\u30B7\u30FC\u30C8ID\u3067\u81EA\u52D5\u7684\u306B\u7F6E\u63DB\u3055\u308C\u307E\u3059\u3002
592
+ - \`google-sheets-oauth_request\`: Google Sheets API\u3092\u547C\u3073\u51FA\u3059\u624B\u6BB5\u3067\u3059\u3002\u8AAD\u307F\u53D6\u308A\u3068\u66F8\u304D\u8FBC\u307F\u306E\u4E21\u65B9\u3092\u30B5\u30DD\u30FC\u30C8\u3057\u307E\u3059\u3002\u30B9\u30D7\u30EC\u30C3\u30C9\u30B7\u30FC\u30C8\u306E\u30E1\u30BF\u30C7\u30FC\u30BF\u30FB\u30BB\u30EB\u5024\u306E\u53D6\u5F97/\u66F4\u65B0\u3001\u65B0\u3057\u3044\u30B9\u30D7\u30EC\u30C3\u30C9\u30B7\u30FC\u30C8\u306E\u4F5C\u6210\u306A\u3069\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002OAuth\u7D4C\u7531\u3067\u8A8D\u8A3C\u306F\u81EA\u52D5\u8A2D\u5B9A\u3055\u308C\u307E\u3059\u3002\u30D1\u30B9\u5185\u306E{spreadsheetId}\u30D7\u30EC\u30FC\u30B9\u30DB\u30EB\u30C0\u30FC\u306F\u8A2D\u5B9A\u6E08\u307F\u306E\u30C7\u30D5\u30A9\u30EB\u30C8\u30B9\u30D7\u30EC\u30C3\u30C9\u30B7\u30FC\u30C8ID\u3067\u81EA\u52D5\u7684\u306B\u7F6E\u63DB\u3055\u308C\u307E\u3059\u3002
507
593
 
508
594
  ### Google Sheets API \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9
509
595
 
510
- #### \u5229\u7528\u53EF\u80FD\u306A\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8
596
+ #### \u8AAD\u307F\u53D6\u308A\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8
511
597
  - GET \`/{spreadsheetId}\` \u2014 \u30B9\u30D7\u30EC\u30C3\u30C9\u30B7\u30FC\u30C8\u306E\u30E1\u30BF\u30C7\u30FC\u30BF\u3092\u53D6\u5F97\uFF08\u30BF\u30A4\u30C8\u30EB\u3001\u30B7\u30FC\u30C8\u3001\u30D7\u30ED\u30D1\u30C6\u30A3\uFF09
512
598
  - GET \`/{spreadsheetId}/values/{range}\` \u2014 \u7BC4\u56F2\u306E\u30BB\u30EB\u5024\u3092\u53D6\u5F97
513
599
  - GET \`/{spreadsheetId}/values:batchGet?ranges={range1}&ranges={range2}\` \u2014 \u8907\u6570\u7BC4\u56F2\u306E\u5024\u3092\u53D6\u5F97
514
600
 
601
+ #### \u66F8\u304D\u8FBC\u307F\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8
602
+ - POST \`\`\uFF08\u7A7A\u30D1\u30B9\u3001\u30DC\u30C7\u30A3\u4ED8\u304D\uFF09\u2014 \u65B0\u3057\u3044\u30B9\u30D7\u30EC\u30C3\u30C9\u30B7\u30FC\u30C8\u3092\u4F5C\u6210\u3002Body: \`{ "properties": { "title": "\u30DE\u30A4\u30B7\u30FC\u30C8" }, "sheets": [{ "properties": { "title": "Sheet1" } }] }\`
603
+ - PUT \`/{spreadsheetId}/values/{range}?valueInputOption=USER_ENTERED\` \u2014 \u7BC4\u56F2\u306E\u30BB\u30EB\u5024\u3092\u66F4\u65B0\u3002Body: \`{ "range": "Sheet1!A1:B2", "majorDimension": "ROWS", "values": [["a","b"],["c","d"]] }\`
604
+ - POST \`/{spreadsheetId}/values/{range}:append?valueInputOption=USER_ENTERED&insertDataOption=INSERT_ROWS\` \u2014 \u6700\u7D42\u884C\u306E\u5F8C\u306B\u884C\u3092\u8FFD\u52A0\u3002Body: \`{ "range": "Sheet1!A1", "majorDimension": "ROWS", "values": [["a","b"]] }\`
605
+ - POST \`/{spreadsheetId}:batchUpdate\` \u2014 \u8907\u6570\u306E\u66F4\u65B0\u3092\u9069\u7528\uFF08\u66F8\u5F0F\u8A2D\u5B9A\u3001\u30B7\u30FC\u30C8\u8FFD\u52A0\u3001\u30BB\u30EB\u7D50\u5408\u306A\u3069\uFF09\u3002Body: \`{ "requests": [...] }\`
606
+
515
607
  ### \u7BC4\u56F2\u306E\u8868\u8A18\u6CD5\uFF08A1\u8868\u8A18\u6CD5\uFF09
516
608
  - \`Sheet1!A1:D10\` \u2014 Sheet1\u4E0A\u306E\u7279\u5B9A\u7BC4\u56F2
517
609
  - \`Sheet1!A:A\` \u2014 Sheet1\u306EA\u5217\u5168\u4F53
@@ -525,6 +617,7 @@ batch.valueRanges.forEach(vr => console.log(vr.range, vr.values));
525
617
  - \u8868\u793A\u5024\u3092\u53D6\u5F97\u3059\u308B\u306B\u306F \`valueRenderOption=FORMATTED_VALUE\` \u30AF\u30A8\u30EA\u30D1\u30E9\u30E1\u30FC\u30BF\u3092\u4F7F\u7528\u3057\u307E\u3059
526
618
  - \u751F\u306E\u6570\u5024\u3092\u53D6\u5F97\u3059\u308B\u306B\u306F \`valueRenderOption=UNFORMATTED_VALUE\` \u3092\u4F7F\u7528\u3057\u307E\u3059
527
619
  - \u5217\u3054\u3068\u306B\u30C7\u30FC\u30BF\u3092\u53D6\u5F97\u3059\u308B\u306B\u306F \`majorDimension=COLUMNS\` \u3092\u4F7F\u7528\u3057\u307E\u3059
620
+ - \u66F8\u304D\u8FBC\u307F\u64CD\u4F5C\u3067\u306F\u5E38\u306B \`valueInputOption=USER_ENTERED\` \u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u5024\u304C\u30E6\u30FC\u30B6\u30FC\u5165\u529B\u306E\u3088\u3046\u306B\u89E3\u6790\u3055\u308C\u307E\u3059\uFF08\u65E5\u4ED8\u3001\u6570\u5024\u3001\u6570\u5F0F\u304C\u81EA\u52D5\u691C\u51FA\uFF09
528
621
 
529
622
  ### Business Logic
530
623
 
@@ -537,17 +630,27 @@ import { connection } from "@squadbase/vite-server/connectors/google-sheets-oaut
537
630
 
538
631
  const sheets = connection("<connectionId>");
539
632
 
540
- // Get spreadsheet metadata
633
+ // \u30B9\u30D7\u30EC\u30C3\u30C9\u30B7\u30FC\u30C8\u306E\u30E1\u30BF\u30C7\u30FC\u30BF\u3092\u53D6\u5F97
541
634
  const metadata = await sheets.getSpreadsheet();
542
635
  console.log(metadata.properties.title, metadata.sheets.map(s => s.properties.title));
543
636
 
544
- // Get cell values
637
+ // \u30BB\u30EB\u5024\u3092\u53D6\u5F97
545
638
  const values = await sheets.getValues("Sheet1!A1:D10");
546
639
  console.log(values.values); // 2D array
547
640
 
548
- // Get multiple ranges at once
641
+ // \u8907\u6570\u7BC4\u56F2\u306E\u5024\u3092\u4E00\u5EA6\u306B\u53D6\u5F97
549
642
  const batch = await sheets.batchGetValues(["Sheet1!A1:B5", "Sheet2!A1:C3"]);
550
643
  batch.valueRanges.forEach(vr => console.log(vr.range, vr.values));
644
+
645
+ // \u30BB\u30EB\u5024\u3092\u66F4\u65B0
646
+ await sheets.updateValues("Sheet1!A1:B2", [["\u540D\u524D", "\u30B9\u30B3\u30A2"], ["Alice", "100"]]);
647
+
648
+ // \u884C\u3092\u8FFD\u52A0
649
+ await sheets.appendValues("Sheet1!A1", [["Bob", "95"], ["Charlie", "88"]]);
650
+
651
+ // \u65B0\u3057\u3044\u30B9\u30D7\u30EC\u30C3\u30C9\u30B7\u30FC\u30C8\u3092\u4F5C\u6210
652
+ const newSheet = await sheets.createSpreadsheet("\u58F2\u4E0A\u30EC\u30DD\u30FC\u30C8", ["Q1", "Q2", "Q3", "Q4"]);
653
+ console.log(newSheet.spreadsheetId, newSheet.spreadsheetUrl);
551
654
  \`\`\``
552
655
  },
553
656
  tools,
@@ -0,0 +1,5 @@
1
+ import * as _squadbase_connectors_sdk from '@squadbase/connectors/sdk';
2
+
3
+ declare const connection: (connectionId: string) => _squadbase_connectors_sdk.GoogleSlidesConnectorSdk;
4
+
5
+ export { connection };