Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion components/google_sheets/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/google_sheets",
"version": "0.8.8",
"version": "0.8.9",
"description": "Pipedream Google_sheets Components",
"main": "google_sheets.app.mjs",
"keywords": [
Expand Down
26 changes: 17 additions & 9 deletions components/google_sheets/sources/common/new-row-added.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ export default {
hasHeaders: {
type: "boolean",
label: "Has Headers",
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.",
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.",
default: false,
optional: true,
},
headerRow: {
type: "integer",
label: "Header Row Number",
description: "The row number containing the column headers (e.g., 1 for the first row). Only used when 'Has Headers' is enabled.",
description: "The row number containing the column headers (e.g., `1` for the first row). Only used when **Has Headers** is enabled.",
default: 1,
optional: true,
},
Expand Down Expand Up @@ -233,15 +233,23 @@ export default {
rowHashes[rowHashString] = true;

// Transform row to object using headers if enabled
const transformedRow = this._transformRowToObject(newRow, headers);
const rowAsObject = this._transformRowToObject(newRow, headers);

// Emit event with backward-compatible structure
const eventData = {
newRow, // Always keep the original array format for backward compatibility
range,
worksheet,
rowNumber,
};

// Only add rowAsObject if headers are enabled and transformation resulted in an object
if (this.hasHeaders && typeof rowAsObject === "object" && !Array.isArray(rowAsObject)) {
eventData.rowAsObject = rowAsObject;
}

this.$emit(
{
newRow: transformedRow,
range,
worksheet,
rowNumber,
},
eventData,
this.getMeta(worksheet, rowNumber, rowHashString),
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default {
key: "google_sheets-new-row-added-polling",
name: "New Row Added",
description: "Emit new event each time a row or rows are added to the bottom of a spreadsheet.",
version: "0.0.7",
version: "0.0.8",
dedupe: "unique",
type: "source",
props: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default {
key: "google_sheets-new-row-added",
name: "New Row Added (Instant)",
description: "Emit new event each time a row or rows are added to the bottom of a spreadsheet.",
version: "0.1.15",
version: "0.1.16",
dedupe: "unique",
type: "source",
props: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
export default {
"newRow": {
"newRow": [
"John Doe",
"john@example.com",
"30"
],
"rowAsObject": {
"Name": "John Doe",
"Email": "john@example.com",
"Age": "30"
Expand Down
Loading