Skip to main content
Question

PostgreSQL clear old data from Google Sheets

  • November 4, 2024
  • 4 replies
  • 32 views

I have a google sheet pulling from PostgreSQL, I have the Zap adding and updating rows, however, I need to remove rows that no longer exist in the database. I know I can’t fully delete a row but can I blank out rows that have been removed?

I’m stuck with PostgreSQL as the input but am not wed to Googlesheets so if this is possible with another output such as ZapTables or Excel I’m happy to do it that way.

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

4 replies

Troy Tessalone
Zapier Orchestrator & Solution Partner
Forum|alt.badge.img+14
  • Zapier Orchestrator & Solution Partner
  • 34031 replies
  • November 4, 2024

Hi @PeterCaliach 

You’d likely need to try this type of logic…

Add a column to indicate a row was added/updated.

Then after processing the data from PostgreSQL, you can search for rows that don’t have a column value to indicate the row was added/updated.

Zap action: GSheets - Lookup Rows

The Looping Zap app can be used to iterate on the returned list of rows to then clear out.


Troy Tessalone
Zapier Orchestrator & Solution Partner
Forum|alt.badge.img+14
  • Zapier Orchestrator & Solution Partner
  • 34031 replies
  • November 4, 2024

@PeterCaliach 

Airtable or Zapier Tables would be another options vs GSheets/Excel.

May depend on the number of records/rows you are trying to process.

 


Troy Tessalone
Zapier Orchestrator & Solution Partner
Forum|alt.badge.img+14
  • Zapier Orchestrator & Solution Partner
  • 34031 replies
  • November 4, 2024

@PeterCaliach 

Another approach may be to simply clear the entire GSheet except for Row 1 with the column headers, then add all the new records as rows.

A GSheets API request can be used to clear a worksheet.

Help link for creating custom actions in Zapier for Zap apps with the help of AI: https://help.zapier.com/hc/en-us/articles/16277139110157-Create-a-custom-action


JammerS
Forum|alt.badge.img+6
  • Zapier Staff
  • 3527 replies
  • November 6, 2024

Hi @PeterCaliach,
 
We just wanted to see how everything is going with your Zap. Did Troy's recommendation get the job done? Feel free to reach out if you need further assistance with your Zap. We're glad to address any concerns and assist you.
 
We're looking forward to your response.