Checks a database table every hour and appends any records it has not copied yet to a Google Sheet.

UsesGoogle SheetsSupabase

Copy new database records to a spreadsheet

Every hour, the workflow reads a table in your Supabase database and appends any record it has not copied before as a new row in a Google Sheet. People who cannot open the database get a live copy of the table in a spreadsheet, and the database itself is only ever read, never changed.

Each row holds the record's id, when it was created, its name and its email. The sheet is the memory: column A holds every copied id, and a record whose id is already there is skipped, so a second run adds nothing new, re-running after a failure is safe, and deleting a row from the sheet has that record copied again. Nothing already in the sheet is overwritten. A record with no id is skipped and reported, since it could never be told apart later, while a record missing a name or email is still copied with that cell left blank.

If the sheet is empty, a heading row is written first. The whole table is read on each run, so it suits tables up to a few thousand rows.

ScheduleRun every hour.Run every hour.
ValuesSet tableName to blank.Set tableName to blank.
ValuesSet spreadsheetUrl to blank.Set spreadsheetUrl to blank.
ValuesSet sheetName to Sheet1.Set sheetName to Sheet1.
Google SheetsGoogle SheetsRead column 'A' of sheetName in spreadsheetUrl. Save it as sheetColumn.Read column 'A' of sheetName in spreadsheetUrl. Save it as sheetColumn.
ValuesSet copiedKeys to sheetColumn.values.Set copiedKeys to sheetColumn.values.
Decisions & LoopsIf copiedKeys is emptyIf copiedKeys is empty
Yes
Google SheetsGoogle SheetsAdd a row to sheetName in spreadsheetUrl.Add a row to sheetName in spreadsheetUrl.
ListsAdd Record ID to the end of copiedKeys and save it as copiedKeys.Add Record ID to the end of copiedKeys and save it as copiedKeys.
No
No steps
SupabaseSupabaseList rows from tableName. Save it as lookup.List rows from tableName. Save it as lookup.
ValuesSet records to lookup.rows.Set records to lookup.rows.
ValuesSet addedCount to 0.Set addedCount to 0.
Decisions & LoopsFor each record in records:For each record in records:
ValuesSet idValue to record.id.Set idValue to record.id.
Decisions & LoopsIf idValue is emptyIf idValue is empty
Yes
ValuesShow in the output: Skipped a record with no 'id' column - nothing to identify it by..Show in the output: Skipped a record with no 'id' column - nothing to identify it by..
Decisions & LoopsSkip to the next item.Skip to the next item.
No
No steps
ValuesSet recordKey to idValue.Set recordKey to idValue.
Decisions & LoopsIf recordKey is emptyIf recordKey is empty
Yes
ValuesShow in the output: Skipped a record whose 'id' is empty..Show in the output: Skipped a record whose 'id' is empty..
Decisions & LoopsSkip to the next item.Skip to the next item.
No
No steps
Decisions & LoopsIf copiedKeys contains recordKeyIf copiedKeys contains recordKey
Yes
Decisions & LoopsSkip to the next item.Skip to the next item.
No
No steps
ValuesSet createdAt to blank.Set createdAt to blank.
Decisions & LoopsIf record.created_at isn't emptyIf record.created_at isn't empty
Yes
ValuesChange createdAt to record.created_at.Change createdAt to record.created_at.
No
No steps
ValuesSet recordName to blank.Set recordName to blank.
Decisions & LoopsIf record.name isn't emptyIf record.name isn't empty
Yes
ValuesChange recordName to record.name.Change recordName to record.name.
No
No steps
ValuesSet recordEmail to blank.Set recordEmail to blank.
Decisions & LoopsIf record.email isn't emptyIf record.email isn't empty
Yes
ValuesChange recordEmail to record.email.Change recordEmail to record.email.
No
No steps
Decisions & LoopsIf a step below fails, save the error as appendErrorIf a step below fails, save the error as appendError
Try
Google SheetsGoogle SheetsAdd a row to sheetName in spreadsheetUrl.Add a row to sheetName in spreadsheetUrl.
ListsAdd recordKey to the end of copiedKeys and save it as copiedKeys.Add recordKey to the end of copiedKeys and save it as copiedKeys.
ValuesAdd 1 to addedCount.Add 1 to addedCount.
On error
ValuesShow in the output: Could not copy record recordKey: appendError as text.Show in the output: Could not copy record recordKey: appendError as text.
ValuesShow in the output: Copied addedCount as text new record(s) into the spreadsheet.Show in the output: Copied addedCount as text new record(s) into the spreadsheet.