Skip to content

Commit

Permalink
fix(Google Sheets Node): Fix exception if no matching rows are found
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-radency committed Nov 29, 2022
1 parent aff8cd9 commit 579f9c4
Showing 1 changed file with 2 additions and 1 deletion.
Expand Up @@ -129,6 +129,7 @@ export function trimLeadingEmptyRows(
}

export function removeEmptyColumns(data: SheetRangeData) {
if (!data || data.length === 0) return [];
const returnData: SheetRangeData = [];
const longestRow = data.reduce((a, b) => (a.length > b.length ? a : b), []).length;
for (let col = 0; col < longestRow; col++) {
Expand All @@ -138,7 +139,7 @@ export function removeEmptyColumns(data: SheetRangeData) {
returnData.push(column);
}
}
return returnData[0].map((_, i) => returnData.map((row) => row[i] || ''));
return (returnData[0] || []).map((_, i) => returnData.map((row) => row[i] || ''));
}

export function prepareSheetData(
Expand Down

0 comments on commit 579f9c4

Please sign in to comment.