This code analyzes a Google Sheet document to identify and categorize its sheets as either templates or data sheets based on their titles. It then returns an organized object containing these categorized sheets.
test templates google sheetThis code snippet is a unit test that verifies if a function called getTemplates
successfully retrieves at least one template from a specified Google Sheet. It uses assertions to check the result and includes optional logging for debugging.
The getInfo
function takes a Google Sheet URL, authenticates with the Google Sheets API, and returns a structured object containing information about the spreadsheet and its sheets. This function is designed to be used by other parts of an application to access Google Sheet data.
The getDataSheet
function retrieves data from a specified worksheet in a Google Sheet and converts it into a structured array of objects. This function is designed to be used by other parts of an application to easily access and work with Google Sheet data.
This code defines a function getRows
that retrieves data from a specified worksheet in a Google Sheet, handling authentication and API interactions to return the data as an array of rows.
This code snippet is a unit test that verifies the ability to retrieve and process data from a specific Google Sheet using functions from a local module. It asserts the existence of a data sheet and checks if the processed data array contains at least one element.
add row data google sheetThe addRow
function adds a new row to a specified sheet in a Google Sheet by leveraging the updateRow
function from a local module. It takes the sheet URL, the new row data, and the sheet number as input.
The getSheetByName
function efficiently retrieves a specific worksheet from a Google Sheet by name or index, utilizing caching to optimize performance. It handles both direct worksheet objects and spreadsheet IDs with worksheet names or indices as input.
The updateRow
function updates a specific row in a Google Sheet based on a matching condition, utilizing helper functions for data formatting and range calculation. It leverages the Google Sheets API to perform the update and returns the modified row data.
This code snippet is a unit test that verifies the functionality of a function responsible for adding a new row of data to a specified Google Sheet. It asserts that the function successfully adds a row by checking if a row is returned after the function is called.
authorize sheets apiThis code sets up authentication with the Google Sheets API and provides a function, authorizeSheets
, that returns an authorized client for interacting with Google Sheets securely.