Sheet selection and mapping
This commit is contained in:
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user