From 19303e7a906e20d040245426779609c0dd10590d Mon Sep 17 00:00:00 2001 From: Viranch Mehta Date: Sun, 5 Mar 2023 01:30:42 -0800 Subject: [PATCH 1/2] Filter down the list of sheets to grid-type only, fixes #107 --- src/integrations/google/googleIntegration.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/integrations/google/googleIntegration.ts b/src/integrations/google/googleIntegration.ts index 3529b536..3a478f93 100644 --- a/src/integrations/google/googleIntegration.ts +++ b/src/integrations/google/googleIntegration.ts @@ -75,8 +75,11 @@ export class GoogleIntegration { return this.sheets .get({ spreadsheetId: documentId || this.googleConfig.documentId }) .then(res => { - logInfo(`Fetched ${res.data.sheets.length} sheets.`, res.data.sheets) - return res.data.sheets + let sheets = res.data.sheets + logInfo(`Fetched ${sheets.length} sheets.`, sheets) + sheets = sheets.filter(s => s.properties.sheetType == 'GRID') + logInfo(`${sheets.length} grid-type sheets`) + return sheets }) .catch(error => { logError(`Error fetching sheets for spreadsheet ${this.googleConfig.documentId}.`, error) From 220283d9655693bec62a86d42ca95f9a42fb99c4 Mon Sep 17 00:00:00 2001 From: Viranch Mehta Date: Tue, 7 Mar 2023 12:51:03 -0800 Subject: [PATCH 2/2] Move sheet filter to formatSheets to fix sheet sorting --- src/integrations/google/googleIntegration.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/integrations/google/googleIntegration.ts b/src/integrations/google/googleIntegration.ts index 3a478f93..27bbc6e2 100644 --- a/src/integrations/google/googleIntegration.ts +++ b/src/integrations/google/googleIntegration.ts @@ -75,11 +75,8 @@ export class GoogleIntegration { return this.sheets .get({ spreadsheetId: documentId || this.googleConfig.documentId }) .then(res => { - let sheets = res.data.sheets - logInfo(`Fetched ${sheets.length} sheets.`, sheets) - sheets = sheets.filter(s => s.properties.sheetType == 'GRID') - logInfo(`${sheets.length} grid-type sheets`) - return sheets + logInfo(`Fetched ${res.data.sheets.length} sheets.`, res.data.sheets) + return res.data.sheets }) .catch(error => { logError(`Error fetching sheets for spreadsheet ${this.googleConfig.documentId}.`, error) @@ -236,6 +233,7 @@ export class GoogleIntegration { spreadsheetId: this.googleConfig.documentId, requestBody: { requests: sheets + .filter(sheet => sheet.properties.sheetType == 'GRID') .map(sheet => [ { repeatCell: {