SheetsClearValuesTool()Create a tool from an API key.
Tool for clearing values from a Google Spreadsheet range.
Inherits from
SheetsBaseTool.
Clears cell values from a specified range while preserving formatting and structure.
Requires OAuth2 authentication. Use api_resource parameter with
authenticated Google Sheets service.
Only values are cleared. Formatting, borders, colors, fonts, and data validation rules remain intact.
Tool Output:
success (bool): Whether operation succeeded. spreadsheet_id (str): The spreadsheet ID. cleared_range (str): The A1 notation of the cleared range.
Clear a range of cells:
from langchain_google_community.sheets import SheetsClearValuesTool
tool = SheetsClearValuesTool(api_resource=service)
result = tool.run(
{
"spreadsheet_id": "1TI6vO9eGsAeXcfgEjoEYcu4RgSZCUF4vdWGLBpg9-fg",
"range": "Sheet1!A1:Z100",
}
)