{ "name": "Save Google Maps Business Leads to Sheets", "tags": [ { "id": "TlcNkmb96fUfZ2eA", "name": "Tutorials", "createdAt": "2025-04-15T17:02:00.249Z", "updatedAt": "2025-04-15T17:02:00.249Z" } ], "nodes": [ { "id": "google-maps-leads-to-sheets-0", "name": "Trigger: Manual Test Run", "type": "n8n-nodes-base.manualTrigger", "position": [ 0, 120 ], "parameters": {}, "typeVersion": 1 }, { "id": "google-maps-leads-to-sheets-1", "name": "Set the search query", "type": "n8n-nodes-base.code", "typeVersion": 2, "parameters": { "mode": "runOnceForAllItems", "jsCode": "function query({query}){if(typeof query!=='string'||!query.trim()||query.length>1000)throw Error('Enter a search query');return {body:{query:query.trim(),language:'en'}};}\n\nreturn [{json:query({query:'coffee shops in New York'})}];" } }, { "id": "google-maps-leads-to-sheets-2", "name": "Search Google Maps via Dumpling AI", "type": "n8n-nodes-base.httpRequest", "position": [ 220, 120 ], "parameters": { "url": "https://app.dumplingai.com/api/v1/search-maps", "method": "POST", "options": {}, "jsonBody": "={{ $json.body }}", "sendBody": true, "specifyBody": "json", "authentication": "genericCredentialType", "genericAuthType": "httpHeaderAuth" }, "typeVersion": 4.2 }, { "id": "google-maps-leads-to-sheets-3", "name": "Prepare sheet rows", "type": "n8n-nodes-base.code", "typeVersion": 2, "parameters": { "mode": "runOnceForAllItems", "jsCode": "function rows({body,statusCode,bodyEncoding}){if(statusCode<200||statusCode>=300||bodyEncoding!==null||!body||!Array.isArray(body.places))throw Error('Maps search failed or returned no places array');const scalar=x=>x==null?'':(typeof x==='string'||typeof x==='boolean'||(typeof x==='number'&&Number.isFinite(x)))?x:(()=>{throw Error('Invalid place field')})();const rows=body.places.map(p=>{if(!p||typeof p.title!=='string'||typeof p.address!=='string')throw Error('Invalid place');if(p.bookingLinks!=null&&!Array.isArray(p.bookingLinks))throw Error('Invalid booking links');return [p.title,p.address,scalar(p.rating),scalar(p.priceLevel),scalar(p.type),scalar(p.bookingLinks?.[0]),scalar(p.website),scalar(p.phoneNumber),scalar(p.position)]});return {rows,hasRows:rows.length>0};}\n\nconst r=rows({body:$input.first().json,statusCode:200,bodyEncoding:null});return r.rows.map(x=>({json:{'Name':x[0],'Address':x[1],rating:x[2],priceLevel:x[3],type:x[4],'Booking Link':x[5],Website:x[6],'Phone number':x[7],Position:x[8]}}));" } }, { "id": "google-maps-leads-to-sheets-4", "name": "Save Results to Google Sheet (Place Info)", "type": "n8n-nodes-base.googleSheets", "position": [ 660, 120 ], "parameters": { "operation": "append", "documentId": { "__rl": true, "mode": "id", "value": "YOUR_SPREADSHEET_ID" }, "sheetName": { "__rl": true, "mode": "name", "value": "Sheet1" }, "columns": { "mappingMode": "defineBelow", "value": { "Name": "={{ $json[\"Name\"] }}", "Address": "={{ $json[\"Address\"] }}", "rating": "={{ $json[\"rating\"] }}", "priceLevel": "={{ $json[\"priceLevel\"] }}", "type": "={{ $json[\"type\"] }}", "Booking Link": "={{ $json[\"Booking Link\"] }}", "Website": "={{ $json[\"Website\"] }}", "Phone number": "={{ $json[\"Phone number\"] }}", "Position": "={{ $json[\"Position\"] }}" }, "schema": [ { "id": "Name", "displayName": "Name", "type": "string", "display": true, "required": false, "defaultMatch": false, "canBeUsedToMatch": true }, { "id": "Address", "displayName": "Address", "type": "string", "display": true, "required": false, "defaultMatch": false, "canBeUsedToMatch": true }, { "id": "rating", "displayName": "rating", "type": "string", "display": true, "required": false, "defaultMatch": false, "canBeUsedToMatch": true }, { "id": "priceLevel", "displayName": "priceLevel", "type": "string", "display": true, "required": false, "defaultMatch": false, "canBeUsedToMatch": true }, { "id": "type", "displayName": "type", "type": "string", "display": true, "required": false, "defaultMatch": false, "canBeUsedToMatch": true }, { "id": "Booking Link", "displayName": "Booking Link", "type": "string", "display": true, "required": false, "defaultMatch": false, "canBeUsedToMatch": true }, { "id": "Website", "displayName": "Website", "type": "string", "display": true, "required": false, "defaultMatch": false, "canBeUsedToMatch": true }, { "id": "Phone number", "displayName": "Phone number", "type": "string", "display": true, "required": false, "defaultMatch": false, "canBeUsedToMatch": true }, { "id": "Position", "displayName": "Position", "type": "string", "display": true, "required": false, "defaultMatch": false, "canBeUsedToMatch": true } ], "matchingColumns": [] }, "options": { "cellFormat": "RAW", "useAppend": true } }, "typeVersion": 4.5 } ], "active": false, "pinData": {}, "settings": { "executionOrder": "v1" }, "connections": { "Trigger: Manual Test Run": { "main": [ [ { "node": "Set the search query", "type": "main", "index": 0 } ] ] }, "Set the search query": { "main": [ [ { "node": "Search Google Maps via Dumpling AI", "type": "main", "index": 0 } ] ] }, "Search Google Maps via Dumpling AI": { "main": [ [ { "node": "Prepare sheet rows", "type": "main", "index": 0 } ] ] }, "Prepare sheet rows": { "main": [ [ { "node": "Save Results to Google Sheet (Place Info)", "type": "main", "index": 0 } ] ] } } }