Duplicates when retrieving records from PostgreSQL database and adding to a google sheet

Hi all,

This is my second time using Make so I am very new to the platform. This is driving my crazy as I cannot find a very simple option to exclude duplicate rows being added to my google sheet.

My current setup
A PostgreSQL module - that triggers every hour using “Select row(s) from table”
(Selecting id, name, email, timestamp)
A Google Sheet Module - using “Add a row”

This works, it gets the data and adds a row, however it adds ALL the data over and over.

My goal
To have it only add new rows that do not already exist in the sheet to stop duplicate data and me burning through operations at an alarming rate.

Am I missing something obvious here?

Thanks for any help!

Welcome to the Make community!

One way would be to add a filter in the “Select row(s) from a table” module (if possible) to only select items that were created since the last scenario run. Since you are running the scenario hourly, you can use this as the datetime variable:

{{ addHours(now; -1) }}

If the “Select row(s) from a table” module did not implement filtering, you can try

Screenshot_2024-03-14_190326

a WHERE clause in the “Execute a query” module to only select items that were created since the last scenario run. Since you are running the scenario hourly, you can use this as the datetime variable:

{{ addHours(now; -1) }}

For more information, see

If you need further assistance, please provide the following:

1. Screenshots of module fields and filters

Please share screenshots of relevant module fields and filters in question? It would really help other community members to see what you’re looking at.

You can upload images here using the Upload icon in the text editor:
Screenshot_2023-10-07_111039

2. Scenario blueprint

Please export the scenario blueprint file to allow others to view the mappings and settings. At the bottom of the scenario editor, you can click on the three dots to find the Export Blueprint menu item.

Screenshot_2023-08-24_230826
(Note: Exporting your scenario will not include private information or keys to your connections)

Uploading it here will look like this:

blueprint.json (12.3 KB)

3. And most importantly, Input/Output bundles

Please provide the input and output bundles of the modules by running the scenario (or get from the scenario History tab), then click the white speech bubble on the top-right of each module and select “Download input/output bundles”.
Screenshot_2023-10-06_141025

A.

Save each bundle contents in your text editor as a bundle.txt file, and upload it here into this discussion thread.

Uploading them here will look like this:

module-1-input-bundle.txt (12.3 KB)
module-1-output-bundle.txt (12.3 KB)

B.

If you are unable to upload files on this forum, alternatively you can paste the formatted bundles in this manner:

  • Either add three backticks ``` before and after the code, like this:

    ```
    input/output bundle content goes here
    ```

  • Or use the format code button in the editor:
    Screenshot_2023-10-02_191027

Providing the input/output bundles will allow others to replicate what is going on in the scenario even if they do not use the external service.

Following these steps will allow others to assist you here. Thanks!

3 Likes

Thanks for the warm welcome and the thorough help samliew, that has done the trick!

1 Like

No problem, glad I could help!

In fact, I didn’t even know anything about PostgreSQL. I just read whatever I know from the Help Center, and also completed the Make Academy which I highly recommend.

1. If you have a new question in the future, please start a new thread. This makes it easier for others with the same problem to search for the answers to specific questions, and you are more likely to receive help since newer questions are monitored closely.

2. The Make Community guidelines encourages users to try to mark helpful replies as solutions to help keep the Community organized.

This marks the topic as solved, so that:

others can save time when catching up with the latest activity here, and

  • allows others to quickly jump to the solution if they come across the same problem

To do this, simply click the checkbox at the bottom of the post that answers your question:
Screenshot_2023-10-04_161049

3. Don’t forget to like and bookmark this topic so you can get back to it easily in future!

2 Likes