The ID of the Google Sheets spreadsheet.
The name of the range in the spreadsheet to retrieve data from.
const spreadsheetId = 'your_spreadsheet_id_here';
const range = 'Sheet1!A1:D5';
(async () => {
try {
const data = await getDataFromSheet(spreadsheetId, range);
console.log(data);
} catch (error) {
console.error(error);
}
})();
Generated using TypeDoc
Retrieves data from a specified Google Sheets spreadsheet and range.
This function uses the Google Sheets API to fetch data from a specified spreadsheet. It requires the spreadsheet ID and the name of the spreadsheet range to retrieve the data from. The function assumes that the 'GOOGLE_APPLICATION_CREDENTIALS' environment variable is set with the path to the Google service account credentials JSON file. It returns the data from the spreadsheet.
Set up the 'GOOGLE_APPLICATION_CREDENTIALS' environment variable: export GOOGLE_APPLICATION_CREDENTIALS=path_to_your_credentials.json