Skip to content

add: AppendOrUpdateRowAction — upsert a row by key column value - #7

Merged
warrenbuckley merged 5 commits into
mainfrom
feat/google-sheets-append-or-update-row
Jul 10, 2026
Merged

add: AppendOrUpdateRowAction — upsert a row by key column value#7
warrenbuckley merged 5 commits into
mainfrom
feat/google-sheets-append-or-update-row

Conversation

@warrenbuckley

@warrenbuckley warrenbuckley commented Jun 29, 2026

Copy link
Copy Markdown
Member

Summary

  • Adds AppendOrUpdateRowAction (googleSheets.appendOrUpdateRow) — an upsert that updates an existing row if the key column value is found, or appends a new row if not
  • Two API calls: GET all rows to find match → PUT (found) or POST :append (not found)
  • Named outcomes: updated / appended
  • The key value is derived from Columns[keyColumnIndex] — no separate "key value" field, avoiding redundant input
  • Output: RowNumber, UpdatedRange, UpdatedRows, UpdatedCells

Test plan

  • dotnet test — all AppendOrUpdate tests pass
  • Manual: run with a new key value → row appended, outcome appended
  • Manual: run again with the same key value and different column data → existing row updated in-place, outcome updated
  • Manual: verify the key column value comes from the Columns list (not a separate field) — change it in Columns and confirm the lookup uses the new value

Suggested automation workflow

Content publish log — Every time a content node is published in Umbraco, upsert a row keyed on the node ID into a "Published Pages" sheet. The first publish appends a new row; subsequent publishes update the "Last Published" date in place — no duplicates.

🤖 Generated with Claude Code

warrenbuckley and others added 5 commits June 29, 2026 22:58
…dex conversion

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Fetches all rows, updates in-place if the key value is found, otherwise appends.
Returns "updated"/"appended" outcomes so workflows can branch on which path ran.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…s, key column derivation

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…path failures in AppendOrUpdateRowAction

The key value is derived by indexing into Columns at KeyColumn's position
rather than a separate field. If KeyColumn pointed past the end of Columns
(e.g. keying on column C while only supplying 2 column values), the derived
key silently defaulted to empty string and would exact-match — and
overwrite — the first row with a blank cell in that column. This is easier
to hit than the equivalent gap in Update/Delete since it's driven by static
settings rather than a runtime-bound value, so validate it explicitly.

Also add missing failure-path tests for both write branches (the PUT update
and the POST append) — only the initial GET's failure path was tested.
@warrenbuckley
warrenbuckley merged commit e6be120 into main Jul 10, 2026
3 checks passed
@warrenbuckley
warrenbuckley deleted the feat/google-sheets-append-or-update-row branch July 10, 2026 13:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant