This guide shows how to work with Athena Sheets programmatically using the TypeScript SDK. The Sheets API provides comprehensive functionality for reading data, updating cells, managing tables, formatting, and more.
Key features:
The Data Frame API allows you to read and extract structured data from CSV files and spreadsheets. This is useful for loading existing data into your application or processing file contents programmatically.
Extract data from spreadsheet files:
Extract data from CSV files with custom separators:
Use column indices or names to select specific data:
Here’s a complete example that reads CSV data and transforms it:
The dataFrame method returns a DataFrameResponse with the following structure:
The dataFrame method accepts the following parameters:
Update the value of a specific cell in a spreadsheet.
Update multiple cells at once with a 2D array of values.
Apply formatting while updating cell values.
Delete cells in a specified range (shifts cells up or left).
Clear the contents of cells in a range without deleting them.
Apply formatting to a range of cells.
Remove all formatting from a range of cells.
Insert one or more new rows at a specific position.
Insert a new column at a specific position.
Delete one or more columns.
Add a new sheet tab to the spreadsheet.
Create a copy of an existing sheet.
Tables in Athena Sheets provide structured data with named columns, making it easier to work with data programmatically.
Create a new table from a range of cells.
Retrieve all data from a table including column names and rows.
Add new rows to a table with structured data.
Modify the range of an existing table.
Add a new column to an existing table.
Remove a column from a table.
Here’s a complete example that demonstrates multiple operations:
The CellFormat interface provides extensive formatting options:
All sheet operations return a SheetOperationResponse:
The getTable operation returns a GetTableResponse:
The createTab operation returns a CreateNewSheetTabResponse:
updateRange instead of multiple updateCell calls for better performancesuccess field in responsesdimension_index for table column operations