Queries in Two Minute Reports help getting data into Google Sheets. More often you would want your queries to get new data onto sheets while updating the already fetched data from the previous query run. If you’ve been utilizing the “Append new data” feature, it offers a convenient capability to add the latest data at the end of your spreadsheet, while preserving the existing entries. This adds new data at the end of the last row without overwriting or deleting previous rows.
However, encountering duplicate rows in your spreadsheet can sometimes be an unexpected consequence. In such situations, it is better to use the “Merge new data with old” option, this feature updates old rows and inserts new data at the end of the last row, ensuring no duplicate records end up in your spreadsheet.This article explores the details of the “Merge new data with old” option, showing you how it helps maintain clean and up-to-date data without any duplicates.
Using the “Merge New Data with Old” Feature
Before using the “Merge new data with old” feature, make sure to enable the Advanced Scheduler Access by going to My Account -> Preferences. Then you can start using this feature.
Here is how it works,
1. Lets launch TMR and add a new query.
2. Lets select “Last 7 days” as the date range.
3. Click on the data options at the bottom of the query and enable the “Merge new data with old” feature and run the query.
4. Now the query will write data for the last 7 days date range
5. Now even if we re-run the same query, you will find only 7 records are present in the sheet. Also you would find that the old records were updated with the latest values.
This is because TMR automatically checks if there are any existing records and retains only the latest records overwriting the old one. And so duplicate records are avoided.
6. Keeping the latest data and avoiding duplicates works in later situations too. For example if we re-run the query a day later, TMR will fetch the latest 7 days data and update all the existing rows (6 rows in this case, that we fetched the previous day) and add a new row (today’s data), resulting in an 8-day dataset.
You can see that the sanity of the date range was maintained while still updating the data with latest values. “Merge New Data with Old” works by adding new records and replacing existing records that were fetched in the past.
This way your spreadsheets are updated and kept clean without any duplicates.