Clear a range in a Google Sheet
clear_sheet_rangeClear a cell range in Google Sheets without deleting rows. Run it once to get the exact filled-cell count, then confirm with that number to avoid wiping unintended data.
Instructions
Empty a range of cells in a Google Sheet, leaving the rows themselves in place. DESTRUCTIVE: call it WITHOUT confirm first and nothing is cleared — you get back the real number of filled cells in that exact range. Show the user that number, get an unambiguous yes, then call again with confirm:true AND confirmCells set to it. The echo is not ceremony: it is what catches naming A1:Z1000 when you meant A1:Z10, which is the mistake that actually happens. There is deliberately NO default range. The clear is read back and reported as confirmed only if the range really is empty afterwards. To remove a whole tab instead, use manage_sheet_tabs.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| range | Yes | the range to clear, e.g. "A2:D50" or "Sheet1!A2:D50" | |
| confirm | No | ||
| sheetUrl | No | ||
| confirmCells | No | echo back the filled-cell count the unconfirmed call reported | |
| spreadsheetId | No |