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

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.