gws.sheets.duplicate_tab
Duplicate a tab in a Google Spreadsheet to reuse its content, formulas, and formatting for a new tab. Specify source by title or ID and optional position; fails if new title exists.
Instructions
Duplicate an existing tab (sheet) within the same Google Spreadsheet, e.g. copy last month's invoice tab to start this month's. Uses DuplicateSheetRequest, so values, formulas, formatting, merged cells, and column widths are copied. Identify the source with source_tab (exact title) or source_sheet_id (from list_tabs). insert_index is the zero-based position of the new tab (default: last). Returns an error — without changing anything — if a tab named new_title already exists. Returns the new tab's title, sheet_id, and index. This tool modifies the user's document: confirm intent with the user before calling it on documents you did not create in this session.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| account | No | Account label or email. Uses default if omitted. | |
| new_title | Yes | Title for the new tab; must not already exist | |
| source_tab | No | Title of the tab to copy (either this or source_sheet_id is required) | |
| insert_index | No | Zero-based position for the new tab (default: after the last tab) | |
| spreadsheet_id | Yes | The spreadsheet ID | |
| source_sheet_id | No | Sheet ID of the tab to copy (either this or source_tab is required) |