mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
fix(Google Sheets Node): Fix exception if no matching rows are found
This commit is contained in:
@@ -129,6 +129,7 @@ export function trimLeadingEmptyRows(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function removeEmptyColumns(data: SheetRangeData) {
|
export function removeEmptyColumns(data: SheetRangeData) {
|
||||||
|
if (!data || data.length === 0) return [];
|
||||||
const returnData: SheetRangeData = [];
|
const returnData: SheetRangeData = [];
|
||||||
const longestRow = data.reduce((a, b) => (a.length > b.length ? a : b), []).length;
|
const longestRow = data.reduce((a, b) => (a.length > b.length ? a : b), []).length;
|
||||||
for (let col = 0; col < longestRow; col++) {
|
for (let col = 0; col < longestRow; col++) {
|
||||||
@@ -138,7 +139,7 @@ export function removeEmptyColumns(data: SheetRangeData) {
|
|||||||
returnData.push(column);
|
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(
|
export function prepareSheetData(
|
||||||
|
|||||||
Reference in New Issue
Block a user