Skip to content

Commit 7da17ec

Browse files
committed
[BUG] Implemented a backward-compatible solution to fix the breaking change in the Google Sheets New Row Added source
1 parent c4e584e commit 7da17ec

File tree

5 files changed

+26
-13
lines changed

5 files changed

+26
-13
lines changed

components/google_sheets/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/google_sheets",
3-
"version": "0.8.8",
3+
"version": "0.8.9",
44
"description": "Pipedream Google_sheets Components",
55
"main": "google_sheets.app.mjs",
66
"keywords": [

components/google_sheets/sources/common/new-row-added.mjs

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ export default {
2323
hasHeaders: {
2424
type: "boolean",
2525
label: "Has Headers",
26-
description: "Set to true if your spreadsheet contains column headers. When enabled, webhook responses will use column headers as keys instead of positional array indices.",
26+
description: "Set to `true` if your spreadsheet contains column headers. When enabled, an additional `rowAsObject` field will be included in webhook responses with column headers as keys. The original `newRow` array format is always preserved for backward compatibility.",
2727
default: false,
2828
optional: true,
2929
},
3030
headerRow: {
3131
type: "integer",
3232
label: "Header Row Number",
33-
description: "The row number containing the column headers (e.g., 1 for the first row). Only used when 'Has Headers' is enabled.",
33+
description: "The row number containing the column headers (e.g., `1` for the first row). Only used when **Has Headers** is enabled.",
3434
default: 1,
3535
optional: true,
3636
},
@@ -233,15 +233,23 @@ export default {
233233
rowHashes[rowHashString] = true;
234234

235235
// Transform row to object using headers if enabled
236-
const transformedRow = this._transformRowToObject(newRow, headers);
236+
const rowAsObject = this._transformRowToObject(newRow, headers);
237+
238+
// Emit event with backward-compatible structure
239+
const eventData = {
240+
newRow, // Always keep the original array format for backward compatibility
241+
range,
242+
worksheet,
243+
rowNumber,
244+
};
245+
246+
// Only add rowAsObject if headers are enabled and transformation resulted in an object
247+
if (this.hasHeaders && typeof rowAsObject === "object" && !Array.isArray(rowAsObject)) {
248+
eventData.rowAsObject = rowAsObject;
249+
}
237250

238251
this.$emit(
239-
{
240-
newRow: transformedRow,
241-
range,
242-
worksheet,
243-
rowNumber,
244-
},
252+
eventData,
245253
this.getMeta(worksheet, rowNumber, rowHashString),
246254
);
247255
}

components/google_sheets/sources/new-row-added-polling/new-row-added-polling.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export default {
88
key: "google_sheets-new-row-added-polling",
99
name: "New Row Added",
1010
description: "Emit new event each time a row or rows are added to the bottom of a spreadsheet.",
11-
version: "0.0.7",
11+
version: "0.0.8",
1212
dedupe: "unique",
1313
type: "source",
1414
props: {

components/google_sheets/sources/new-row-added/new-row-added.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export default {
88
key: "google_sheets-new-row-added",
99
name: "New Row Added (Instant)",
1010
description: "Emit new event each time a row or rows are added to the bottom of a spreadsheet.",
11-
version: "0.1.15",
11+
version: "0.1.16",
1212
dedupe: "unique",
1313
type: "source",
1414
props: {

components/google_sheets/sources/new-row-added/test-event.mjs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
export default {
2-
"newRow": {
2+
"newRow": [
3+
"John Doe",
4+
5+
"30"
6+
],
7+
"rowAsObject": {
38
"Name": "John Doe",
49
"Email": "[email protected]",
510
"Age": "30"

0 commit comments

Comments
 (0)