From 54406376c51ed725f6fd98a046493c85f40f293d Mon Sep 17 00:00:00 2001 From: michelle0927 Date: Wed, 18 Oct 2023 13:28:21 -0400 Subject: [PATCH] convert column index to label --- components/google_sheets/package.json | 2 +- .../google_sheets/sources/common/new-updates.mjs | 10 +++++++++- .../new-updates-shared-drive.mjs | 2 +- .../google_sheets/sources/new-updates/new-updates.mjs | 2 +- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/components/google_sheets/package.json b/components/google_sheets/package.json index d88851bab33e5..c781932f33b0e 100644 --- a/components/google_sheets/package.json +++ b/components/google_sheets/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/google_sheets", - "version": "0.5.6", + "version": "0.5.7", "description": "Pipedream Google_sheets Components", "main": "google_sheets.app.mjs", "keywords": [ diff --git a/components/google_sheets/sources/common/new-updates.mjs b/components/google_sheets/sources/common/new-updates.mjs index d8a977c924cff..e1060a2f7d8d4 100644 --- a/components/google_sheets/sources/common/new-updates.mjs +++ b/components/google_sheets/sources/common/new-updates.mjs @@ -67,6 +67,14 @@ export default { _setSheetValues(id, sheetValues) { this.db.set(id, sheetValues); }, + indexToColumnLabel(index) { + let columnLabel = ""; + while (index >= 0) { + columnLabel = String.fromCharCode((index % 26) + 65) + columnLabel; + index = Math.floor(index / 26) - 1; + } + return columnLabel; + }, getContentChanges(colCount, newValues, oldValues, changes, i) { // loop through comparing the values of each cell for (let j = 0; j < colCount; j++) { @@ -82,7 +90,7 @@ export default { : ""; if (newValue !== oldValue) { changes.push({ - cell: `${String.fromCharCode(j + 65)}:${i + 1}`, + cell: `${this.indexToColumnLabel(j)}:${i + 1}`, previous_value: oldValue, new_value: newValue, }); diff --git a/components/google_sheets/sources/new-updates-shared-drive/new-updates-shared-drive.mjs b/components/google_sheets/sources/new-updates-shared-drive/new-updates-shared-drive.mjs index d644fa1a183ec..a91e53c2f8d66 100644 --- a/components/google_sheets/sources/new-updates-shared-drive/new-updates-shared-drive.mjs +++ b/components/google_sheets/sources/new-updates-shared-drive/new-updates-shared-drive.mjs @@ -9,7 +9,7 @@ export default { type: "source", name: "New Updates (Shared Drive, Instant)", description: "Emit new event each time a row or cell is updated in a spreadsheet in a shared drive", - version: "0.1.3", + version: "0.1.4", dedupe: "unique", props: { ...httpBase.props, diff --git a/components/google_sheets/sources/new-updates/new-updates.mjs b/components/google_sheets/sources/new-updates/new-updates.mjs index 51c092e3ce379..caab681170f51 100644 --- a/components/google_sheets/sources/new-updates/new-updates.mjs +++ b/components/google_sheets/sources/new-updates/new-updates.mjs @@ -9,7 +9,7 @@ export default { type: "source", name: "New Updates (Instant)", description: "Emit new event each time a row or cell is updated in a spreadsheet. To use this source with a spreadsheet in a [Shared Drive](https://support.google.com/a/users/answer/9310351), use the **New Updates (Shared Drive, Instant)** source instead.", - version: "0.1.3", + version: "0.1.4", dedupe: "unique", props: { ...httpBase.props,