{"product_id":"upsert-lection-webhook-data-to-google-sheets-deduping","title":"Upsert Lection Webhook Data to Google Sheets (Deduping)","description":"\u003ch3\u003eUpsert Lection webhook data into Google Sheets—without duplicates\u003c\/h3\u003e\n\u003cp\u003eThis n8n workflow receives scheduled scrape results from \u003cstrong\u003eLection\u003c\/strong\u003e and writes the dataset into \u003cstrong\u003eGoogle Sheets\u003c\/strong\u003e using an \u003cstrong\u003eupsert (append or update)\u003c\/strong\u003e strategy based on a unique column, so you keep your sheet clean and deduplicated.\u003c\/p\u003e\n\n\u003ch3\u003eWhat this workflow does\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003eReceives a Lection webhook (POST)\u003c\/strong\u003e for a scheduled scrape delivery.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eValidates security\u003c\/strong\u003e by comparing the incoming \u003ccode\u003ex-lection-secret\u003c\/code\u003e header to a configured shared secret; if it doesn’t match, the workflow returns \u003ccode\u003e401\u003c\/code\u003e.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eEnsures the event is correct\u003c\/strong\u003e: it checks for \u003ccode\u003escheduled_scrape.completed\u003c\/code\u003e and confirms the dataset contains at least one row—otherwise it returns a JSON response indicating nothing was written.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eSplits incoming records\u003c\/strong\u003e from \u003ccode\u003ebody.dataset.records\u003c\/code\u003e into individual items.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eUpserts into Google Sheets\u003c\/strong\u003e for each record using “append or update” based on your chosen matching (unique) column.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eResponds with a summary\u003c\/strong\u003e to Lection, including how many rows were written.\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eUse cases\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003eMaintain a continuously updated Google Sheet from Lection scheduled scraping jobs (e.g., product listings, listings datasets, or crawl results).\u003c\/li\u003e\n  \u003cli\u003eRun periodic scrapes and safely re-import results without creating duplicate rows.\u003c\/li\u003e\n  \u003cli\u003eUse a single source of truth in Google Sheets for downstream processes and reporting.\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eTechnical details\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003eWebhook\u003c\/strong\u003e: n8n receives Lection events and performs \u003ccode\u003ex-lection-secret\u003c\/code\u003e verification.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eif\u003c\/strong\u003e: validates event type and dataset row presence.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eSplit out\u003c\/strong\u003e + \u003cstrong\u003eaggregate\u003c\/strong\u003e: processes each \u003ccode\u003ebody.dataset.records\u003c\/code\u003e item and summarizes write results.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eGoogle Sheets\u003c\/strong\u003e: writes to a specified Spreadsheet ID and sheet name, configured with a \u003cstrong\u003ematching (unique) column\u003c\/strong\u003e for deduping\/upsert behavior.\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003cp\u003e\u003cstrong\u003eSetup tip:\u003c\/strong\u003e Create a Google Sheet with a header row whose column names exactly match Lection’s \u003ccode\u003edataset.records\u003c\/code\u003e field names, then configure the target spreadsheet, sheet name, and the deduping matching column in the Google Sheets node.\u003c\/p\u003e","brand":"N8N Commerce","offers":[{"title":"Default Title","offer_id":46223933112499,"sku":"N8N-20923","price":71.99,"currency_code":"GBP","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0749\/6279\/6723\/files\/dW8q1lw0sOLZsd1_u8YuF_BZj5d445.png?v=1791968983","url":"https:\/\/buyflowscripts.com\/products\/upsert-lection-webhook-data-to-google-sheets-deduping","provider":"N8N Commerce","version":"1.0","type":"link"}