Sheet selection and mapping

This commit is contained in:
Roman Krček
2025-07-17 16:15:23 +02:00
parent f83595f3c3
commit c6ea10e1d6
8 changed files with 750 additions and 9 deletions

View File

@@ -100,6 +100,22 @@ export async function searchSheets(query: string) {
return response.result.files || [];
}
export async function getSheetNames(spreadsheetId: string) {
if (!gapi.client.sheets) {
throw new Error('Google Sheets API not loaded');
}
const response = await gapi.client.sheets.spreadsheets.get({
spreadsheetId,
fields: 'sheets.properties'
});
if (!response.result.sheets) {
return [];
}
return response.result.sheets.map(sheet => sheet.properties?.title || '');
}
export async function getSheetData(spreadsheetId: string, range: string) {
if (!gapi.client.sheets) {
throw new Error('Google Sheets API not loaded');