Help for google maps scraper automation

2 Problems: My maps scraper will scrape maybe or 7 or 8 places and only them specific places AND I have set up for it to add an email and website onto a google sheets, when appending onto the google sheets it will do the websites firsts on one column and the second column starts on correct collumn B but starts below all the previously existing websites

{
“nodes”: [
{
“parameters”: {},
“type”: “n8n-nodes-base.manualTrigger”,
“typeVersion”: 1,
“position”: [
-1280,
-16
],
“id”: “0e113aa5-a214-40fb-abd0-5a51807b0694”,
“name”: “When clicking ‘Execute workflow’”
},
{
“parameters”: {
“url”: “={{ $json.urlList }}”,
“options”: {}
},
“type”: “n8n-nodes-base.httpRequest”,
“typeVersion”: 4.2,
“position”: [
-608,
-16
],
“id”: “27cc25a8-cf18-4777-b5bb-c7d805ecac84”,
“name”: “HTTP Request”
},
{
“parameters”: {
“jsCode”: “const input = $input.first().json.data\nconst regex = /https?:\/\/[^\s"]+/g\nconst websites = input.match(regex);\n\nreturn websites.map(website => ({json:{website}}))”
},
“type”: “n8n-nodes-base.code”,
“typeVersion”: 2,
“position”: [
-384,
-16
],
“id”: “b6db453d-6c57-4afb-b5a5-69083f4bdf88”,
“name”: “Code”
},
{
“parameters”: {
“conditions”: {
“options”: {
“caseSensitive”: true,
“leftValue”: “”,
“typeValidation”: “strict”,
“version”: 2
},
“conditions”: [
{
“id”: “12c90f47-06e5-400a-bfa4-ca74b41e452d”,
“leftValue”: “={{ $json.website }}”,
“rightValue”: “schema”,
“operator”: {
“type”: “string”,
“operation”: “notContains”
}
},
{
“id”: “f664810c-00e2-457b-8361-04b01fdfe52f”,
“leftValue”: “={{ $json.website }}”,
“rightValue”: “google”,
“operator”: {
“type”: “string”,
“operation”: “notContains”
}
},
{
“id”: “f1bba93e-1e3e-4cb3-a152-631b6b0128cc”,
“leftValue”: “={{ $json.website }}”,
“rightValue”: “ggpht”,
“operator”: {
“type”: “string”,
“operation”: “notContains”
}
},
{
“id”: “b5c701a3-6c0f-4448-980c-ab877870f33f”,
“leftValue”: “={{ $json.website }}”,
“rightValue”: “docs”,
“operator”: {
“type”: “string”,
“operation”: “notContains”
}
},
{
“id”: “9b5a46ff-eabe-4e6e-909b-4e141560d257”,
“leftValue”: “={{ $json.website }}”,
“rightValue”: “gstatic”,
“operator”: {
“type”: “string”,
“operation”: “notContains”
}
},
{
“id”: “e1d96227-946b-4b0b-a55c-791db4a4b704”,
“leftValue”: “={{ $json.website }}”,
“rightValue”: “locations”,
“operator”: {
“type”: “string”,
“operation”: “notContains”
}
},
{
“id”: “daae3f9a-ec7e-4018-8e7f-9c2b4f13f000”,
“leftValue”: “={{ $json.website }}”,
“rightValue”: “opentable”,
“operator”: {
“type”: “string”,
“operation”: “notContains”
}
},
{
“id”: “21b82d62-5edd-42e1-adcb-7b91252c7152”,
“leftValue”: “={{ $json.website }}”,
“rightValue”: “bookings”,
“operator”: {
“type”: “string”,
“operation”: “notContains”
}
},
{
“id”: “a205eb7f-969d-490d-9c36-6b140cf198ef”,
“leftValue”: “={{ $json.website }}”,
“rightValue”: “reserve”,
“operator”: {
“type”: “string”,
“operation”: “notContains”
}
},
{
“id”: “8a66154f-99c4-411c-acbc-c50eaea81a28”,
“leftValue”: “={{ $json.website }}”,
“rightValue”: “\\u003d”,
“operator”: {
“type”: “string”,
“operation”: “notContains”
}
}
],
“combinator”: “and”
},
“options”: {}
},
“type”: “n8n-nodes-base.filter”,
“typeVersion”: 2.2,
“position”: [
-384,
-208
],
“id”: “22dc5866-7839-4d0e-b107-e779b78b2050”,
“name”: “Filter”
},
{
“parameters”: {
“options”: {}
},
“type”: “n8n-nodes-base.splitInBatches”,
“typeVersion”: 3,
“position”: [
64,
-112
],
“id”: “2384f9b7-d338-40a6-836d-775c2db95c88”,
“name”: “Loop Over Items”
},
{
“parameters”: {
“url”: “={{ $json.website }}”,
“options”: {}
},
“type”: “n8n-nodes-base.httpRequest”,
“typeVersion”: 4.2,
“position”: [
288,
-112
],
“id”: “fbee2baa-dd9b-46db-a9da-ab70f01d5971”,
“name”: “HTTP Request1”,
“onError”: “continueRegularOutput”
},
{
“parameters”: {
“amount”: 1
},
“type”: “n8n-nodes-base.wait”,
“typeVersion”: 1.1,
“position”: [
512,
-112
],
“id”: “5f9e4fb6-1ac5-4d50-8261-6c132ce02f98”,
“name”: “Wait”,
“webhookId”: “b08f3988-98e9-4b8c-bdf6-74ed88ebc49f”,
“onError”: “continueRegularOutput”
},
{
“parameters”: {
“jsCode”: “const input = $input.first().json.data\nconst emailRegex = /[a-zA-Z0-9._%±]+@[a-zA-Z0-9.-]+\.(?!png|jpg|gif|jpeg)[a-zA-Z]{2,}/g\nconst emails = input.match(emailRegex)\n\nreturn {json: {emails: emails}}”
},
“type”: “n8n-nodes-base.code”,
“typeVersion”: 2,
“position”: [
736,
-40
],
“id”: “bfdb43a8-20b3-439d-a7ee-b91e26f70f4e”,
“name”: “Code1”,
“onError”: “continueRegularOutput”
},
{
“parameters”: {
“amount”: 1
},
“type”: “n8n-nodes-base.wait”,
“typeVersion”: 1.1,
“position”: [
288,
-304
],
“id”: “243c8fc4-17cb-4301-b5da-0ccc34ecca03”,
“name”: “Wait1”,
“webhookId”: “096f37b1-50b3-49c9-935f-4156c81c08d8”
},
{
“parameters”: {
“conditions”: {
“options”: {
“caseSensitive”: true,
“leftValue”: “”,
“typeValidation”: “strict”,
“version”: 2
},
“conditions”: [
{
“id”: “e597d012-788f-4512-8581-b3c4c1bc28bc”,
“leftValue”: “={{ $json.emails }}”,
“rightValue”: “null”,
“operator”: {
“type”: “string”,
“operation”: “exists”,
“singleValue”: true
}
},
{
“id”: “46c97c55-c627-4722-a495-1574801d8b30”,
“leftValue”: “={{ $json.error }}”,
“rightValue”: “error”,
“operator”: {
“type”: “string”,
“operation”: “notExists”,
“singleValue”: true
}
}
],
“combinator”: “and”
},
“options”: {}
},
“type”: “n8n-nodes-base.filter”,
“typeVersion”: 2.2,
“position”: [
736,
-304
],
“id”: “c1f7f903-7b91-42eb-854e-06572945e8a4”,
“name”: “Filter1”
},
{
“parameters”: {
“options”: {}
},
“type”: “n8n-nodes-base.removeDuplicates”,
“typeVersion”: 2,
“position”: [
960,
-304
],
“id”: “7f26fcd6-812a-44da-a6ca-830a9d0c95f8”,
“name”: “Remove Duplicates”
},
{
“parameters”: {
“operation”: “appendOrUpdate”,
“documentId”: {
“__rl”: true,
“value”: “1flJ4kK9zclhyBemEl88-yPhuERV2yc5taFEsyH9MQ0M”,
“mode”: “list”,
“cachedResultName”: "Email leads ",
“cachedResultUrl”: “http.s://docs.google.com/spreadsheets/d/1flJ4kK9zclhyBemEl88-yPhuERV2yc5taFEsyH9MQ0M/edit?usp=drivesdk”
},
“sheetName”: {
“__rl”: true,
“value”: “gid=0”,
“mode”: “list”,
“cachedResultName”: “Sheet1”,
“cachedResultUrl”: “http.s://docs.google.com/spreadsheets/d/1flJ4kK9zclhyBemEl88-yPhuERV2yc5taFEsyH9MQ0M/edit#gid=0”
},
“columns”: {
“mappingMode”: “defineBelow”,
“value”: {
"Email ": “={{ $json.emails }}”
},
“matchingColumns”: [
"Email "
],
“schema”: [
{
“id”: "Email ",
“displayName”: "Email ",
“required”: false,
“defaultMatch”: false,
“display”: true,
“type”: “string”,
“canBeUsedToMatch”: true,
“removed”: false
},
{
“id”: “Website”,
“displayName”: “Website”,
“required”: false,
“defaultMatch”: false,
“display”: true,
“type”: “string”,
“canBeUsedToMatch”: true,
“removed”: false
}
],
“attemptToConvertTypes”: false,
“convertFieldsToString”: false
},
“options”: {}
},
“type”: “n8n-nodes-base.googleSheets”,
“typeVersion”: 4.6,
“position”: [
1184,
-304
],
“id”: “6ac4ab4a-bac1-4034-8675-c05c02429676”,
“name”: “Append or update row in sheet”,
“credentials”: {
“googleSheetsOAuth2Api”: {
“id”: “Z0pSty68agRdu7o0”,
“name”: “Google Sheets account”
}
}
},
{
“parameters”: {
“fieldToSplitOut”: “emails”,
“options”: {}
},
“type”: “n8n-nodes-base.splitOut”,
“typeVersion”: 1,
“position”: [
512,
-304
],
“id”: “3c78015a-6b61-45ad-b3d7-402f9572751f”,
“name”: “Split Out”
},
{
“parameters”: {
“operation”: “appendOrUpdate”,
“documentId”: {
“__rl”: true,
“value”: “1flJ4kK9zclhyBemEl88-yPhuERV2yc5taFEsyH9MQ0M”,
“mode”: “list”,
“cachedResultName”: "Email leads ",
“cachedResultUrl”: “https://doc.s.google.com/spreadsheets/d/1flJ4kK9zclhyBemEl88-yPhuERV2yc5taFEsyH9MQ0M/edit?usp=drivesdk
},
“sheetName”: {
“__rl”: true,
“value”: “gid=0”,
“mode”: “list”,
“cachedResultName”: “Sheet1”,
“cachedResultUrl”: “https://doc.s.google.com/spreadsheets/d/1flJ4kK9zclhyBemEl88-yPhuERV2yc5taFEsyH9MQ0M/edit#gid=0
},
“columns”: {
“mappingMode”: “defineBelow”,
“value”: {
“Website”: “={{ $json.website }}”
},
“matchingColumns”: [
“Website”
],
“schema”: [
{
“id”: "Email “,
“displayName”: “Email “,
“required”: false,
“defaultMatch”: false,
“display”: true,
“type”: “string”,
“canBeUsedToMatch”: true,
“removed”: false
},
{
“id”: “Website”,
“displayName”: “Website”,
“required”: false,
“defaultMatch”: false,
“display”: true,
“type”: “string”,
“canBeUsedToMatch”: true,
“removed”: false
}
],
“attemptToConvertTypes”: false,
“convertFieldsToString”: false
},
“options”: {}
},
“type”: “n8n-nodes-base.googleSheets”,
“typeVersion”: 4.6,
“position”: [
64,
-304
],
“id”: “b64e3329-195d-4c28-b5fb-088240e5d45c”,
“name”: “Append or update row in sheet1”,
“credentials”: {
“googleSheetsOAuth2Api”: {
“id”: “Z0pSty68agRdu7o0”,
“name”: “Google Sheets account”
}
}
},
{
“parameters”: {
“jsCode”: “const urlList = ["https://www.google.com/maps/search/restaurants+in+manchester\”, "Google Maps”, "Google Maps”];\n\nreturn urlList.map(url => {\nreturn {\njson: {\nurlList: url\n}\n}\n});”
},
“type”: “n8n-nodes-base.code”,
“typeVersion”: 2,
“position”: [
-1056,
-16
],
“id”: “0b5daf20-9b94-47c5-a961-7e5930c6d614”,
“name”: “Code2”
},
{
“parameters”: {
“options”: {}
},
“type”: “n8n-nodes-base.splitInBatches”,
“typeVersion”: 3,
“position”: [
-832,
-16
],
“id”: “ce8d4429-d307-4ecf-8dbe-045e83815ca9”,
“name”: “Loop Over Items1”
},
{
“parameters”: {
“amount”: 1
},
“type”: “n8n-nodes-base.wait”,
“typeVersion”: 1.1,
“position”: [
-160,
56
],
“id”: “53a60d40-7c26-477a-b533-20455334427d”,
“name”: “Wait2”,
“webhookId”: “3f9b72a4-b1ca-4541-91ad-37a4616c913b”
},
{
“parameters”: {
“amount”: 1
},
“type”: “n8n-nodes-base.wait”,
“typeVersion”: 1.1,
“position”: [
-608,
-208
],
“id”: “d1837b86-5895-45ab-ac81-181d07b0cceb”,
“name”: “Wait3”,
“webhookId”: “caa55684-30db-4983-84a3-2241959f65db”
},
{
“parameters”: {
“conditions”: {
“options”: {
“caseSensitive”: true,
“leftValue”: “”,
“typeValidation”: “strict”,
“version”: 2
},
“conditions”: [
{
“id”: “3f037ded-f50a-44ca-b17b-df40ea396dce”,
“leftValue”: “={{ $json.Website }}”,
“rightValue”: “images”,
“operator”: {
“type”: “string”,
“operation”: “notContains”
}
},
{
“id”: “9818bfcd-446a-4fec-a212-4d479bf2ac40”,
“leftValue”: “={{ $json.website }}”,
“rightValue”: “sentry”,
“operator”: {
“type”: “string”,
“operation”: “notContains”
}
}
],
“combinator”: “and”
},
“options”: {}
},
“type”: “n8n-nodes-base.filter”,
“typeVersion”: 2.2,
“position”: [
-160,
-208
],
“id”: “35411715-6c84-4ed1-b750-3095f3e956a1”,
“name”: “Filter2”
}
],
“connections”: {
“When clicking ‘Execute workflow’”: {
“main”: [
[
{
“node”: “Code2”,
“type”: “main”,
“index”: 0
}
]
]
},
“HTTP Request”: {
“main”: [
[
{
“node”: “Code”,
“type”: “main”,
“index”: 0
}
]
]
},
“Code”: {
“main”: [
[
{
“node”: “Wait2”,
“type”: “main”,
“index”: 0
}
]
]
},
“Filter”: {
“main”: [
[
{
“node”: “Filter2”,
“type”: “main”,
“index”: 0
}
]
]
},
“Loop Over Items”: {
“main”: [
[
{
“node”: “Wait1”,
“type”: “main”,
“index”: 0
}
],
[
{
“node”: “HTTP Request1”,
“type”: “main”,
“index”: 0
}
]
]
},
“HTTP Request1”: {
“main”: [
[
{
“node”: “Wait”,
“type”: “main”,
“index”: 0
}
]
]
},
“Wait”: {
“main”: [
[
{
“node”: “Code1”,
“type”: “main”,
“index”: 0
}
]
]
},
“Code1”: {
“main”: [
[
{
“node”: “Loop Over Items”,
“type”: “main”,
“index”: 0
}
]
]
},
“Wait1”: {
“main”: [
[
{
“node”: “Split Out”,
“type”: “main”,
“index”: 0
}
]
]
},
“Filter1”: {
“main”: [
[
{
“node”: “Remove Duplicates”,
“type”: “main”,
“index”: 0
}
]
]
},
“Remove Duplicates”: {
“main”: [
[
{
“node”: “Append or update row in sheet”,
“type”: “main”,
“index”: 0
}
]
]
},
“Split Out”: {
“main”: [
[
{
“node”: “Filter1”,
“type”: “main”,
“index”: 0
}
]
]
},
“Append or update row in sheet1”: {
“main”: [

]
},
“Code2”: {
“main”: [
[
{
“node”: “Loop Over Items1”,
“type”: “main”,
“index”: 0
}
]
]
},
“Loop Over Items1”: {
“main”: [
[
{
“node”: “Wait3”,
“type”: “main”,
“index”: 0
}
],
[
{
“node”: “HTTP Request”,
“type”: “main”,
“index”: 0
}
]
]
},
“Wait2”: {
“main”: [
[
{
“node”: “Loop Over Items1”,
“type”: “main”,
“index”: 0
}
]
]
},
“Wait3”: {
“main”: [
[
{
“node”: “Filter”,
“type”: “main”,
“index”: 0
}
]
]
},
“Filter2”: {
“main”: [
[
{
“node”: “Loop Over Items”,
“type”: “main”,
“index”: 0
},
{
“node”: “Append or update row in sheet1”,
“type”: “main”,
“index”: 0
}
]
]
}
},
“pinData”: {},
“meta”: {
“templateCredsSetupCompleted”: true,
“instanceId”: “c4206b01d6dceb12bbafefa9f90a83adb987e9324d9ef65dc386a494615366cd”
}
}
Above is my workflow.

I have also attached a picture of my results

Notes: I have added a “.” in a few links for the sole purpose of this post as a new account can not add more than 5 links. I am aware of this error.

Also i am a beginner and copied this off of a youtube video as i am only learning. Thanks

Much easier to set up with the Google Maps scraper from Apify, gives you this info directly, and you can start the scrape and collect the data with the built-in Apify node in n8n.

example of comment for google maps. dont respond.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.