mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 12:44:07 -08:00
fix(Google Sheets Node): Fix exception if no matching rows are found
This commit is contained in:
parent
aff8cd9a2b
commit
579f9c4d4e
|
@ -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++) {
|
||||
|
@ -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(
|
||||
|
|
Loading…
Reference in a new issue