Google Docs, Sheets, and Slides
This skill covers three jobs: picking the right connector, keeping edits in the same file, and using each Google API without trial and error.
1. Check the connectors before you start
Each connector does a different job:
| Connector |
What it can do |
| Google Drive |
Create files, upload and convert content, rename, read text, export, trash |
| Google Docs |
Read a doc's structure and edit it in place |
| Google Sheets |
Read cells and write values, formulas, and formatting in place |
| Google Slides |
Read a deck and add or edit slides, shapes, text, and tables in place |
Drive can create all three file types. It can't edit a file after that. Without the matching editor connector, every change means a new file and a new link, and the user loses the link they already have.
Check the connectors before you start:
- Check which Google tools are available in this conversation. On surfaces where tools are deferred, search for and load the editor tools you need first, such as "google sheets update". Tool names differ by surface, so use the names your surface lists. If a search returns nothing, list all available tools before deciding the connector is missing — the tool may exist under a different name.
- If the editor tools are missing, tell the user. When you can list the conversation's connectors, say which case it is: a connector that is set up but turned off in this chat (ask them to turn it on in the chat's connector settings, then continue), or one that isn't connected at all (tell them which connector to add and what it enables).
- With an editor connector missing, a request to create a new file continues with Drive. A change to an existing file stops and asks — see the missing-connector rule in section 2.
- If the user asks only for a new file, create it with Drive. If the editor connector is off, add one line saying edits will need it.
Example: "I can create the sheet now. If you want changes later, turn on the Google Sheets connector in this chat first. Then I can edit this file, and the link will stay the same."
2. Rules for every file
- A change goes in the same file. "Change", "update", "fix", "add", and "switch it to" all mean the user wants the same file and link. Do not recreate the file to skip an edit.
- A missing editor connector is a choice for the user, not a workaround for you. When the user asks for a change to an existing file and the editor connector is missing, your whole reply is a short question, not a deliverable. Building the next-best thing feels helpful, but the user's file is still untouched and now there are two artifacts — the exact failure this skill exists to prevent. Lead with the fix: name the connector and say that with it on, the edit lands in their existing file and the link stays the same. You may offer an alternative — drafted text to paste, or a file to import by hand — but only as a named option, and build it only after the user picks it. Example reply, in full: "To add the slide to your deck directly, turn on the Google Slides connector in this chat and I'll do it — same deck, same link. Or I can draft the slide as a file you'd import by hand. Which do you prefer?"
- Never trash a file the user didn't ask you to delete. Drive can trash a file, but it can't restore one. The Docs, Sheets, and Slides connectors can't open a trashed file.
- Read the file before you edit it. Docs and Slides edits need current positions and object IDs. Sheets formatting needs the numeric
sheetId.
- Verify the result. Read the file again after each edit. Use
get_values for Sheets, read_doc for Docs, and read_presentation for Slides. Check the result before you report it. If the tool accepts the call, that does not mean the content is correct.
- Build long requests with a script. For index math, formula grids, or many formatting requests, write a script that prints the JSON, where you can run code. Then paste the JSON into the tool call — the tool takes inline arguments, not a file path.
- Rename with Drive
update_file. A rename keeps the same link.
- Share the link with each result. Use the
viewUrl from the Drive response. When you edit a file, say that the link stays the same.
3. Google Docs
Create
Call Drive create_file with contentMimeType: "text/html" and the document as textContent. Drive converts <h1>, <h2>, <p>, <ul>, <ol>, <b>, <i>, and <a> into native Docs formatting. This is faster than building a doc with Docs edit requests.
Edit
Use Docs read_doc, then update_doc.
- For a word or phrase, use
replaceAllText. It needs no indexes.
- For a larger rewrite, replace one paragraph at a time. Read each paragraph's
startIndex and endIndex. Delete [start, end - 1] to keep the paragraph's newline and style. Then call insertText at start.
- Order the requests from the highest index to the lowest. Then an edit can't shift the position of an edit later in the batch.
- Inserted text takes the style of the text before it. Reset bold and italic only on body text. Don't reset headings, because that removes their bold.
- To delete a whole paragraph, delete
[start, end].
- Use raw newlines in the text. Don't use escaped
\n.
- Call
read_doc again to check the edit.
4. Google Sheets
Create
- Blank sheet, then fill it: create the file with Drive
create_file and contentMimeType: "application/vnd.google-apps.spreadsheet". Then fill it with Sheets update_formulas. Use this for models and anything with formulas.
- Upload: upload a CSV or an .xlsx built with the
xlsx skill. Drive converts it. Use this for large data sets or many tabs. Then edit the result in place.
Write
update_formulas writes values and formulas. Send numbers as numbers, not text. Store percentages as fractions, such as 0.25 for 25%.
- Write formulas for every calculated cell. Do not write results you computed yourself. Formulas keep the sheet live when the user changes an input.
- Quote tab names that contain spaces or symbols:
'P&L'!F5.
- In a spreadsheet you just created, the first tab's
sheetId is 0. For an existing file or other tabs, call get_spreadsheet with fields: ["sheets.properties"]. Do not use a subselection such as sheets.properties(sheetId,title), because the tool rejects it. To set a new tab's sheetId, include it in addSheet.
- Format with
update_spreadsheet. Use repeatCell for number formats, fonts, and fills. Use updateBorders and updateDimensionProperties for widths. Use updateSheetProperties for names and frozen rows. Ranges use 0-based indexes with exclusive end values. Colors use red, green, and blue values from 0 to 1, not hex.
- Send all formatting in one
update_spreadsheet call.
Verify
get_values returns the calculated, formatted values. Read the whole range you built. Look for #REF!, #DIV/0!, #NAME?, #VALUE!, and #N/A. Check that the totals match the expected numbers.
Financial model conventions
These conventions come from the xlsx skill. Follow them unless the user or the file uses different ones.
- Colors: blue text for inputs, black for formulas, and green for links to another tab.
- Number formats: currency is
$#,##0;($#,##0);"-". Percentages are 0.0%, stored as fractions. Multiples are 0.0x. Years are text.
- Structure: put each assumption in its own labeled cell, and reference that cell in formulas. Use the same formula across each period in a row. Wrap division in
IFERROR.
- Inputs: put a note near the top that says which cells are inputs.
- Existing files: follow the file's conventions. Write only in its input cells. Do not change its formulas.
Function support
Sheets supports XLOOKUP, FILTER, UNIQUE, and SORT, so the xlsx skill's LibreOffice limits do not apply here. If the user may export the file to Excel, avoid Sheets-only functions such as QUERY, ARRAYFORMULA, IMPORTRANGE, and GOOGLEFINANCE.
5. Google Slides
Create
Choose a method based on the deck.
- A designed deck: load the
pptx skill, build a .pptx with it, and check it with that skill's QA steps. Then upload it with Drive create_file and let Drive convert it. You get the pptx skill's design tools and QA. Conversion can change fonts and spacing. Check the result with the QA steps below.
- A few simple slides: create a blank presentation with Drive
create_file and contentMimeType: "application/vnd.google-apps.presentation". Build the slides with update_presentation. The new deck starts with one title slide. Use it, or delete it with deleteObject.
Edit
Use read_presentation, then update_presentation.
- Use a field mask with
read_presentation. Example: ["slides(objectId,pageElements(objectId,size,transform,shape(shapeType,text)))"]. A full read is very large.
- Units: the tool uses EMU. One inch equals 914400 EMU. The default 16:9 page is 9144000 x 5143500 EMU, or 10 x 5.625 in. Get the size from
pageSize before you set positions.
- Object IDs: choose your own IDs when you create objects, such as
s3_title. Each ID must be unique and 5 to 50 characters long. Use these IDs in later requests in the same batch.
- Shapes: use
createShape, then insertText, then updateTextStyle. Font size uses {magnitude, unit: "PT"}. Use updateShapeProperties for fills and outlines.
- Colors: use
rgbColor values from 0 to 1.
- Simple edits: use
replaceAllText for text changes. Use duplicateObject to copy a slide. Use updateSlidesPosition to reorder slides.
- Images:
createImage needs a public URL. If you have only a local image, use the .pptx upload method.
- Charts: use
createSheetsChart to embed a chart from a Google Sheet. Do not use a chart image. An embedded chart stays linked to its data.
- Text fit: Slides does not shrink text to fit. Size each box for its text. If the text does not fit, use a smaller font or split the slide.
Design
Load the pptx skill and use its Design Ideas and Avoid sections. If it is not available, the most important rules:
- Choose a palette that fits the topic. Use one dominant color and one accent.
- Vary the layouts. Give each slide a visual element, such as a chart, a large number, a shape, or an image.
- Use 36 to 44 pt titles and 14 to 16 pt body text. Left-align body text.
- Leave margins of at least 0.5 in and gaps of 0.3 to 0.5 in.
- Don't add accent lines under titles or decorative color bars.
- Use Google fonts, such as Arial, Roboto, Lato, Montserrat, or Merriweather.
QA
- Read the deck with a field mask. Check the text, slide order, and placeholder text.
- Where you can run code, export the deck to PDF with Drive
download_file_content and exportMimeType: "application/pdf". Decode the base64 and render each page with pdftoppm -jpeg -r 110. Check the images for overflow, overlap, and low contrast. If you can't run code or the export fails, rely on step 1 and tell the user you couldn't check the layout.
- Fix the problems and export the deck again to check the fixes.
6. Common failures
| Symptom |
Cause |
Fix |
| "No such tool available" |
The tool is deferred, or the name is different on this surface |
Search for and load the tool. Use the exact name your surface lists. |
| Permission denied on a file you created |
The file is in the trash |
Ask the user to restore it from Drive's trash. You can't restore it with the connectors. |
Sheets Invalid field |
The field mask uses a subselection |
Use sheets.properties and filter the result yourself. |
| A heading loses its bold after an edit |
A style reset was applied to the heading |
Reset styles only on body text. |
| Edits land in the wrong place in a doc |
The requests ran from the lowest index to the highest |
Order the requests from the highest index to the lowest. |
| A Sheets formula shows text |
The formula went to update_values |
Use update_formulas. |
1---2name: google-workspace3description: Create and edit Google Docs, Sheets, and Slides through the Google connectors. Use this whenever the user names a Google file type or shares a docs.google.com link, and for any follow-up change to a Google file made earlier in the chat, even when they just say "change it" or "add a tab".4---56# Google Docs, Sheets, and Slides78This skill covers three jobs: picking the right connector, keeping edits in the same file, and using each Google API without trial and error.910## 1. Check the connectors before you start1112Each connector does a different job:1314| Connector | What it can do |15|---|---|16| Google Drive | Create files, upload and convert content, rename, read text, export, trash |17| Google Docs | Read a doc's structure and edit it in place |18| Google Sheets | Read cells and write values, formulas, and formatting in place |19| Google Slides | Read a deck and add or edit slides, shapes, text, and tables in place |2021Drive can create all three file types. It can't edit a file after that. Without the matching editor connector, every change means a new file and a new link, and the user loses the link they already have.2223Check the connectors before you start:24251. Check which Google tools are available in this conversation. On surfaces where tools are deferred, search for and load the editor tools you need first, such as "google sheets update". Tool names differ by surface, so use the names your surface lists. If a search returns nothing, list all available tools before deciding the connector is missing — the tool may exist under a different name.262. If the editor tools are missing, tell the user. When you can list the conversation's connectors, say which case it is: a connector that is set up but turned off in this chat (ask them to turn it on in the chat's connector settings, then continue), or one that isn't connected at all (tell them which connector to add and what it enables).273. With an editor connector missing, a request to create a new file continues with Drive. A change to an existing file stops and asks — see the missing-connector rule in section 2.284. If the user asks only for a new file, create it with Drive. If the editor connector is off, add one line saying edits will need it.2930Example: "I can create the sheet now. If you want changes later, turn on the Google Sheets connector in this chat first. Then I can edit this file, and the link will stay the same."3132## 2. Rules for every file3334- **A change goes in the same file.** "Change", "update", "fix", "add", and "switch it to" all mean the user wants the same file and link. Do not recreate the file to skip an edit.35- **A missing editor connector is a choice for the user, not a workaround for you.** When the user asks for a change to an existing file and the editor connector is missing, your whole reply is a short question, not a deliverable. Building the next-best thing feels helpful, but the user's file is still untouched and now there are two artifacts — the exact failure this skill exists to prevent. Lead with the fix: name the connector and say that with it on, the edit lands in their existing file and the link stays the same. You may offer an alternative — drafted text to paste, or a file to import by hand — but only as a named option, and build it only after the user picks it. Example reply, in full: "To add the slide to your deck directly, turn on the Google Slides connector in this chat and I'll do it — same deck, same link. Or I can draft the slide as a file you'd import by hand. Which do you prefer?"36- **Never trash a file the user didn't ask you to delete.** Drive can trash a file, but it can't restore one. The Docs, Sheets, and Slides connectors can't open a trashed file.37- **Read the file before you edit it.** Docs and Slides edits need current positions and object IDs. Sheets formatting needs the numeric `sheetId`.38- **Verify the result.** Read the file again after each edit. Use `get_values` for Sheets, `read_doc` for Docs, and `read_presentation` for Slides. Check the result before you report it. If the tool accepts the call, that does not mean the content is correct.39- **Build long requests with a script.** For index math, formula grids, or many formatting requests, write a script that prints the JSON, where you can run code. Then paste the JSON into the tool call — the tool takes inline arguments, not a file path.40- **Rename with Drive `update_file`.** A rename keeps the same link.41- **Share the link with each result.** Use the `viewUrl` from the Drive response. When you edit a file, say that the link stays the same.4243## 3. Google Docs4445### Create4647Call Drive `create_file` with `contentMimeType: "text/html"` and the document as `textContent`. Drive converts `<h1>`, `<h2>`, `<p>`, `<ul>`, `<ol>`, `<b>`, `<i>`, and `<a>` into native Docs formatting. This is faster than building a doc with Docs edit requests.4849### Edit5051Use Docs `read_doc`, then `update_doc`.5253- For a word or phrase, use `replaceAllText`. It needs no indexes.54- For a larger rewrite, replace one paragraph at a time. Read each paragraph's `startIndex` and `endIndex`. Delete `[start, end - 1]` to keep the paragraph's newline and style. Then call `insertText` at `start`.55- Order the requests from the highest index to the lowest. Then an edit can't shift the position of an edit later in the batch.56- Inserted text takes the style of the text before it. Reset bold and italic only on body text. Don't reset headings, because that removes their bold.57- To delete a whole paragraph, delete `[start, end]`.58- Use raw newlines in the text. Don't use escaped `\n`.59- Call `read_doc` again to check the edit.6061## 4. Google Sheets6263### Create6465- **Blank sheet, then fill it:** create the file with Drive `create_file` and `contentMimeType: "application/vnd.google-apps.spreadsheet"`. Then fill it with Sheets `update_formulas`. Use this for models and anything with formulas.66- **Upload:** upload a CSV or an .xlsx built with the `xlsx` skill. Drive converts it. Use this for large data sets or many tabs. Then edit the result in place.6768### Write6970- `update_formulas` writes values and formulas. Send numbers as numbers, not text. Store percentages as fractions, such as `0.25` for 25%.71- Write formulas for every calculated cell. Do not write results you computed yourself. Formulas keep the sheet live when the user changes an input.72- Quote tab names that contain spaces or symbols: `'P&L'!F5`.73- In a spreadsheet you just created, the first tab's `sheetId` is `0`. For an existing file or other tabs, call `get_spreadsheet` with `fields: ["sheets.properties"]`. Do not use a subselection such as `sheets.properties(sheetId,title)`, because the tool rejects it. To set a new tab's `sheetId`, include it in `addSheet`.74- Format with `update_spreadsheet`. Use `repeatCell` for number formats, fonts, and fills. Use `updateBorders` and `updateDimensionProperties` for widths. Use `updateSheetProperties` for names and frozen rows. Ranges use 0-based indexes with exclusive end values. Colors use `red`, `green`, and `blue` values from 0 to 1, not hex.75- Send all formatting in one `update_spreadsheet` call.7677### Verify7879`get_values` returns the calculated, formatted values. Read the whole range you built. Look for `#REF!`, `#DIV/0!`, `#NAME?`, `#VALUE!`, and `#N/A`. Check that the totals match the expected numbers.8081### Financial model conventions8283These conventions come from the `xlsx` skill. Follow them unless the user or the file uses different ones.8485- **Colors:** blue text for inputs, black for formulas, and green for links to another tab.86- **Number formats:** currency is `$#,##0;($#,##0);"-"`. Percentages are `0.0%`, stored as fractions. Multiples are `0.0x`. Years are text.87- **Structure:** put each assumption in its own labeled cell, and reference that cell in formulas. Use the same formula across each period in a row. Wrap division in `IFERROR`.88- **Inputs:** put a note near the top that says which cells are inputs.89- **Existing files:** follow the file's conventions. Write only in its input cells. Do not change its formulas.9091### Function support9293Sheets supports `XLOOKUP`, `FILTER`, `UNIQUE`, and `SORT`, so the `xlsx` skill's LibreOffice limits do not apply here. If the user may export the file to Excel, avoid Sheets-only functions such as `QUERY`, `ARRAYFORMULA`, `IMPORTRANGE`, and `GOOGLEFINANCE`.9495## 5. Google Slides9697### Create9899Choose a method based on the deck.100101- **A designed deck:** load the `pptx` skill, build a .pptx with it, and check it with that skill's QA steps. Then upload it with Drive `create_file` and let Drive convert it. You get the `pptx` skill's design tools and QA. Conversion can change fonts and spacing. Check the result with the QA steps below.102- **A few simple slides:** create a blank presentation with Drive `create_file` and `contentMimeType: "application/vnd.google-apps.presentation"`. Build the slides with `update_presentation`. The new deck starts with one title slide. Use it, or delete it with `deleteObject`.103104### Edit105106Use `read_presentation`, then `update_presentation`.107108- Use a field mask with `read_presentation`. Example: `["slides(objectId,pageElements(objectId,size,transform,shape(shapeType,text)))"]`. A full read is very large.109- **Units:** the tool uses EMU. One inch equals 914400 EMU. The default 16:9 page is 9144000 x 5143500 EMU, or 10 x 5.625 in. Get the size from `pageSize` before you set positions.110- **Object IDs:** choose your own IDs when you create objects, such as `s3_title`. Each ID must be unique and 5 to 50 characters long. Use these IDs in later requests in the same batch.111- **Shapes:** use `createShape`, then `insertText`, then `updateTextStyle`. Font size uses `{magnitude, unit: "PT"}`. Use `updateShapeProperties` for fills and outlines.112- **Colors:** use `rgbColor` values from 0 to 1.113- **Simple edits:** use `replaceAllText` for text changes. Use `duplicateObject` to copy a slide. Use `updateSlidesPosition` to reorder slides.114- **Images:** `createImage` needs a public URL. If you have only a local image, use the .pptx upload method.115- **Charts:** use `createSheetsChart` to embed a chart from a Google Sheet. Do not use a chart image. An embedded chart stays linked to its data.116- **Text fit:** Slides does not shrink text to fit. Size each box for its text. If the text does not fit, use a smaller font or split the slide.117118### Design119120Load the `pptx` skill and use its Design Ideas and Avoid sections. If it is not available, the most important rules:121122- Choose a palette that fits the topic. Use one dominant color and one accent.123- Vary the layouts. Give each slide a visual element, such as a chart, a large number, a shape, or an image.124- Use 36 to 44 pt titles and 14 to 16 pt body text. Left-align body text.125- Leave margins of at least 0.5 in and gaps of 0.3 to 0.5 in.126- Don't add accent lines under titles or decorative color bars.127- Use Google fonts, such as Arial, Roboto, Lato, Montserrat, or Merriweather.128129### QA1301311. Read the deck with a field mask. Check the text, slide order, and placeholder text.1322. Where you can run code, export the deck to PDF with Drive `download_file_content` and `exportMimeType: "application/pdf"`. Decode the base64 and render each page with `pdftoppm -jpeg -r 110`. Check the images for overflow, overlap, and low contrast. If you can't run code or the export fails, rely on step 1 and tell the user you couldn't check the layout.1333. Fix the problems and export the deck again to check the fixes.134135## 6. Common failures136137| Symptom | Cause | Fix |138|---|---|---|139| "No such tool available" | The tool is deferred, or the name is different on this surface | Search for and load the tool. Use the exact name your surface lists. |140| Permission denied on a file you created | The file is in the trash | Ask the user to restore it from Drive's trash. You can't restore it with the connectors. |141| Sheets `Invalid field` | The field mask uses a subselection | Use `sheets.properties` and filter the result yourself. |142| A heading loses its bold after an edit | A style reset was applied to the heading | Reset styles only on body text. |143| Edits land in the wrong place in a doc | The requests ran from the lowest index to the highest | Order the requests from the highest index to the lowest. |144| A Sheets formula shows text | The formula went to `update_values` | Use `update_formulas`. |