Excel Automation: create workbooks, manage worksheets, read/write cell data, and format spreadsheets via Microsoft Excel and Google Sheets integration
SKILL.md
Excel Automation
Automate spreadsheet operations including creating workbooks, writing data, formatting cells, upserting rows, and managing worksheets. Works with Microsoft Excel (OneDrive) and Google Sheets.
This skill requires the Rube MCP server connected at https://rube.app/mcp.
Before executing any tools, ensure an active connection exists for the excel (and optionally googlesheets) toolkit. If no connection is active, initiate one via RUBE_MANAGE_CONNECTIONS.
Core Workflows
1. Create a New Excel Workbook
Use EXCEL_CREATE_WORKBOOK to generate a new .xlsx file and upload it to OneDrive.
Tool:EXCEL_CREATE_WORKBOOK
Steps:
Call EXCEL_CREATE_WORKBOOK with worksheet names and data
The tool creates a .xlsx file and uploads it to OneDrive
Use the returned file path/URL for subsequent operations
2. Write Data to a Spreadsheet
Use GOOGLESHEETS_BATCH_UPDATE to write values to a specific range or append rows.
Tool:GOOGLESHEETS_BATCH_UPDATE
Key Parameters:
spreadsheet_id (required) -- The spreadsheet ID from the URL (44-char alphanumeric string)
Use GOOGLESHEETS_UPSERT_ROWS to update existing rows by matching a key column, or append new rows if no match is found. Ideal for CRM syncs, inventory updates, and deduplication.
Tool:GOOGLESHEETS_UPSERT_ROWS
Key Parameters:
spreadsheetId (required) -- The spreadsheet ID
sheetName (required) -- Tab name
rows (required) -- 2D array of data rows (min 1 row). If headers is omitted, the first row is treated as headers
headers -- Column names for the data, e.g., ["Email","Phone","Status"]
keyColumn -- Column header to match on, e.g., "Email", "SKU", "Lead ID"
Use GOOGLESHEETS_BATCH_GET to retrieve data from specified cell ranges for validation or further processing.
Tool:GOOGLESHEETS_BATCH_GET
Steps:
Call GOOGLESHEETS_BATCH_GET with the spreadsheet ID and target ranges
Validate headers and data alignment
Use results to inform subsequent write or update operations
Supporting Tools:
GOOGLESHEETS_GET_SHEET_NAMES -- List all tab names in a spreadsheet
GOOGLESHEETS_GET_SPREADSHEET_INFO -- Get metadata (sheet IDs, properties)
GOOGLESHEETS_FIND_WORKSHEET_BY_TITLE -- Check if a specific tab exists
Recommended Execution Plan
Create or locate the spreadsheet using GOOGLESHEETS_CREATE_GOOGLE_SHEET1 or reuse an existing spreadsheetId
Confirm the destination tab using GOOGLESHEETS_GET_SHEET_NAMES or GOOGLESHEETS_FIND_WORKSHEET_BY_TITLE; create it with GOOGLESHEETS_ADD_SHEET if missing
Read existing headers (optional) using GOOGLESHEETS_BATCH_GET to align columns
Write or upsert data using GOOGLESHEETS_BATCH_UPDATE or GOOGLESHEETS_UPSERT_ROWS
Apply formatting (optional) using GOOGLESHEETS_FORMAT_CELL
Verify results (optional) using GOOGLESHEETS_BATCH_GET
Fallback: If Google Sheets creation is blocked (HTTP 403), use EXCEL_CREATE_WORKBOOK for local .xlsx output
Known Pitfalls
Pitfall
Detail
HTTP 403 on sheet creation
GOOGLESHEETS_CREATE_GOOGLE_SHEET1 fails when Drive create scope is missing. Reuse an existing spreadsheetId or fall back to EXCEL_CREATE_WORKBOOK.
Cell limit and rate throttling
Google Sheets has a ~5,000,000 cell limit per spreadsheet. Excessive write frequency triggers HTTP 429. Batch changes and chunk large writes (~500 rows/call).
Format range off-by-one
GOOGLESHEETS_FORMAT_CELL uses 0-based, endIndex-exclusive ranges when using index mode. Background color uses 0--1 float RGB, NOT 0--255 integer RGB.
Sheet title uniqueness
Sheet titles are not guaranteed unique across API responses. Prefer operating by numeric sheetId and verify the resolved tab before writing.
Upsert payload shape
GOOGLESHEETS_UPSERT_ROWS requires headers + 2D rows array. Sending list-of-dicts or empty rows causes validation errors. Ensure at least 1 data row.
Quick Reference
Tool Slug
Description
EXCEL_CREATE_WORKBOOK
Create a new .xlsx workbook and upload to OneDrive