Help

Save the date! Join us on October 16 for our Product Ops launch event. Register here.

Bulk merge using an "auto" dedupe

2518 5
cancel
Showing results for 
Search instead for 
Did you mean: 
Nick_Tan
5 - Automation Enthusiast
5 - Automation Enthusiast

Hi Everyone,

Is there an automated way to combine 3 lines into one?

image

image

The context is that, we will have 3 different persons filling in 3 different forms to feed into the same table, but want to combine them into a single line.

Dedupe is OK but we will need to do this 1800 times :frowning: And of course, there are a lot more columns than shown above.

Thanks.

5 Replies 5

Hey Nick, if each form has a unique identifier, then you could set it up so that each form submission gets linked to a single record in another table, and then create lookup fields to display everything nicely? Nice thing is that it’d work for your historical data too

Screenshot 2022-05-31 at 6.54.50 PM
Screenshot 2022-05-31 at 6.54.54 PM

Note that the DeDupe App won’t work for your needs, unfortunately, because Airtable didn’t do a very good job with the DeDupe App. It doesn’t merge data (except for a few field types)… it simply deletes records that you pinpoint as duplicates.

@Adam_TheTimeSavingCo’s solution above is probably the best and easiest and simplest.

However, if you’re really determined to get everything merged onto one line, your best bet is to capture the duplicates on their way into Airtable, which will require some work on your end — it will likely require scripting or the use of an external automation tool, if you’re literally going to be merging data in cells. I don’t know scripting (yet), so personally I use Make.com for this. I just did this exact thing the other day for a client.

Adam, that’s exactly what I was after. Thank you!

Thanks Scott, Adam’s method will work well!

KevinCM
4 - Data Explorer
4 - Data Explorer
Here we go! Please change the table ('YOURTABLE') and column names ("Name")!
It finds the duplicate and merges all cells. Note, however, that the code assumes that the values in the cells are the same if the duplicate records have an entry in the same column. 
 
let table = base.getTable('YOURTABLE');
let query = await table.selectRecordsAsync();
let records = query.records;
 
let uniqueRecords = new Map();
 
for (let record of records) {
    let name = record.getCellValue("Name");
    if (uniqueRecords.has(name)) {
 
        let existingRecord = uniqueRecords.get(name);
        let updatedFields = {};
 
        for (let field of table.fields) {
            let fieldValue = record.getCellValue(field);
            if (fieldValue !== null) {
 
                updatedFields[field.name] = fieldValue;
            }
        }
 
        await table.updateRecordAsync(existingRecord.id, updatedFields);
 
        await table.deleteRecordAsync(record.id);
    } else {
 
        uniqueRecords.set(name, record);
    }
}

 

console.log("Duplicates merged.");