The Problem: 'Same Order' Arrives Twice?
In B2B business, buyers submit orders through Google Forms. But sometimes due to network delays, or buyers accidentally hitting the 'submit' button twice, the exact same order arrives 2~3 times.
The team manually compares and deletes duplicates, wasting 30 minutes every single day.
「Can we catch these duplicates automatically?」
Solution: Claude Code + Google Apps Script
Step 1: Connect Google Form to Spreadsheet
If you're already running a Google Form, responses automatically save to a Google Sheet. (Click 「Link to Sheets」 in the 「Responses」 tab)
Step 2: Open Google Sheets Script Editor
Tools → Script Editor → Create New Project
This is where we use Claude Code.
Step 3: Ask Claude Code to Write the Script
Ask Claude like this:
「In Google Sheets, compare these columns: buyer email, product code, and quantity. Find rows where all three match exactly. Move duplicate entries to a new sheet. Can you write this in AppsScript?」
Here's an example code Claude provides:
function findDuplicateOrders() {
const sheet = SpreadsheetApp.getActiveSheet();
const data = sheet.getDataRange().getValues();
const duplicates = [];
for (let i = 1; i < data.length; i++) {
for (let j = i + 1; j < data.length; j++) {
if (data[i][1] === data[j][1] && data[i][2] === data[j][2] && data[i][3] === data[j][3]) {
duplicates.push(data[j]);
}
}
}
const dupSheet = SpreadsheetApp.getActiveSpreadsheet().insertSheet('Duplicate Items');
dupSheet.getRange(1, 1, duplicates.length, duplicates[0].length).setValues(duplicates);
}
Step 4: Execute and Automate
Script Editor → Run Button → Accept Authorization Popup
Then set up a daily automated trigger:
Left Menu 「Triggers」 → 「Add Trigger」
→ Select findDuplicateOrders function
→ Select time-based (Every day at 7 PM)
Result: Next Morning, 'Duplicate List' is Ready
When the team opens their screens the next morning, yesterday's duplicate orders are already sorted and displayed in the 「Duplicate Items」 sheet.
All they need to do:
• Review duplicate list (2 minutes)
• Keep original, delete copy (3 minutes)
Total: 5 minutes done.
🎯 What Non-Developers Learn
1. **Claude Code turns 「conditions」 into code**: It simply translates 「when buyer email and product code match」 into programming language.
2. **Triggers are the heart of automation**: More important than the code itself is 「when to run it」.
3. **Small automations add up to massive time savings**: 30 minutes a day × 20 days × 12 months = 120 hours saved annually.
Next Level: Smarter Approach
Buyers might complain 「this isn't duplicate, it's two planned batches」. So marking as duplicate but keeping human approval is safer.
Auto-flag duplicates, but final decision stays with the team.