Automatisation du scraping de répertoires vers Google Sheets avec BrowserAct

Intermédiaire

Ceci est unLead Generationworkflow d'automatisation du domainecontenant 15 nœuds.Utilise principalement des nœuds comme Code, GoogleSheets, ManualTrigger, BrowserAct. Extraction automatisée des annuaires YP.com vers Google Sheets avec BrowserAct

Prérequis
  • Informations d'identification Google Sheets API
Aperçu du workflow
Visualisation des connexions entre les nœuds, avec support du zoom et du déplacement
Exporter le workflow
Copiez la configuration JSON suivante dans n8n pour importer et utiliser ce workflow
{
  "id": "fffRt3A8pcGDhAYV",
  "meta": {
    "instanceId": "88804d8e264d231c18413147cc92e4245b20ae7b97d774bad847556f645c8192",
    "templateCredsSetupCompleted": true
  },
  "name": "Automate Directory Scraping to Google Sheets using BrowserAct",
  "tags": [],
  "nodes": [
    {
      "id": "8ad92360-1ee6-44cb-ad18-ff1d898489b0",
      "name": "Lors du clic sur 'Exécuter le workflow'",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -32,
        208
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "281fdee8-0b6e-4f2d-b811-7376e20c14f2",
      "name": "Exécuter une tâche de workflow",
      "type": "n8n-nodes-browseract-workflows.browserAct",
      "position": [
        144,
        208
      ],
      "parameters": {
        "workflowId": "56683859462521975",
        "inputParameters": {
          "parameters": [
            {
              "name": "business_category",
              "value": "dentists"
            },
            {
              "name": "city_location",
              "value": "Brooklyn"
            }
          ]
        },
        "additionalFields": {
          "saveBrowserData": false
        }
      },
      "credentials": {
        "browserActApi": {
          "id": "AzKMhR2eAlOjzDiJ",
          "name": "BrowserAct account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "35073d60-1922-4fec-a162-de41e3c3a037",
      "name": "Obtenir les détails d'une tâche de workflow",
      "type": "n8n-nodes-browseract-workflows.browserAct",
      "position": [
        352,
        208
      ],
      "parameters": {
        "taskId": "={{ $json.id }}",
        "operation": "getTask",
        "maxWaitTime": 600,
        "waitForFinish": true,
        "pollingInterval": 20
      },
      "credentials": {
        "browserActApi": {
          "id": "AzKMhR2eAlOjzDiJ",
          "name": "BrowserAct account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "6efa3204-54af-4b38-95a7-9996028b6166",
      "name": "Code en JavaScript",
      "type": "n8n-nodes-base.code",
      "position": [
        640,
        208
      ],
      "parameters": {
        "jsCode": "// Get the JSON string using the exact path provided by the user.\nconst jsonString = $input.first().json.output.string;\n\nlet parsedData;\n\n// Check if the string exists before attempting to parse\nif (!jsonString) {\n    // Return an empty array or throw an error if no string is found\n    // Throwing an error is usually better to stop the workflow if data is missing.\n    throw new Error(\"Input string is empty or missing at the specified path: $input.first().json.output.string\");\n}\n\ntry {\n    // 1. Parse the JSON string into a JavaScript array of objects\n    parsedData = JSON.parse(jsonString);\n} catch (error) {\n    // Handle JSON parsing errors (e.g., if the string is malformed)\n    throw new Error(`Failed to parse JSON string: ${error.message}`);\n}\n\n// 2. Ensure the parsed data is an array\nif (!Array.isArray(parsedData)) {\n    throw new Error('Parsed data is not an array. It cannot be split into multiple items.');\n}\n\n// 3. Map the array of objects into the n8n item format { json: object }\n// Each element in this array will be treated as a new item by n8n, achieving the split.\nconst outputItems = parsedData.map(item => ({\n    json: item,\n}));\n\n// 4. Return the new array of items\nreturn outputItems;"
      },
      "typeVersion": 2
    },
    {
      "id": "dc54c1f9-db58-48fd-92c1-45091fd18751",
      "name": "Ajouter ou mettre à jour une ligne dans la feuille",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        944,
        208
      ],
      "parameters": {
        "columns": {
          "value": {
            "Address": "={{ $json.Location }}",
            "Category": "={{ $json.Business }}",
            "Company Name": "={{ $json.Name }}",
            "Phone Number": "={{ $json.Phone }}"
          },
          "schema": [
            {
              "id": "Company Name",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Company Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Category",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Category",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Phone Number",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Phone Number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Address",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Address",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Company Name"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 512924235,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/18sw7io0yJOTDzvcknGmjBBqtK154CLk3k0FoWJZbfI0/edit#gid=512924235",
          "cachedResultName": "Online Directory Lead Scraper (YP.com)"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "18sw7io0yJOTDzvcknGmjBBqtK154CLk3k0FoWJZbfI0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/18sw7io0yJOTDzvcknGmjBBqtK154CLk3k0FoWJZbfI0/edit?usp=drivesdk",
          "cachedResultName": "Test For BrowserAct"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "wAMAqU43zjVjlpuA",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "764d9961-c8f2-4b85-a30f-5953edec0645",
      "name": "Note autocollante - Introduction",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -640,
        -160
      ],
      "parameters": {
        "width": 592,
        "height": 424,
        "content": "## Try It Out!\n### This n8n template helps you generate local business leads by scraping online directories and saving the results directly to a spreadsheet.\n\n### How it works\n* The workflow is triggered **manually**. You can replace the trigger with a **Cron** node to run it on a schedule for different search terms.\n* A **BrowserAct** node starts a web scraping task with specific inputs (e.g., 'dentists' in 'Brooklyn') to collect business listings.\n* A second **BrowserAct** node patiently waits for the scraping job to finish.\n* A **Code** node takes the raw scraped data (which arrives as a single text block) and correctly parses and splits it into individual items, one for each business.\n* Finally, the structured business leads are added directly to your **Google Sheet**.\n\n### Requirements\n* **BrowserAct** API account for web scraping.\n* **BrowserAct** **Online Directory Lead Scraper (YP.com)** Template.\n* **Google Sheets** credentials for saving the leads.\n\n\n### Need Help?\nJoin the [Discord](https://discord.com/invite/UpnCKd7GaU) or Visit Our [Blog](https://www.browseract.com/blog)!\n"
      },
      "typeVersion": 1
    },
    {
      "id": "708ca10f-6d70-4b8d-8a28-4e551509b05f",
      "name": "Note autocollante - Mode d'emploi",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -640,
        272
      ],
      "parameters": {
        "width": 592,
        "height": 208,
        "content": "## How to use\n\n1.  **Set up Credentials:** Add your credentials for **BrowserAct** and **Google Sheets** to the workflow.\n2.  **Customize Your Search:** In the **Run a workflow task** node, change the `business_category` and `city_location` values to find the leads you need.\n3. Make sure you have **BrowserAct** **Online Directory Lead Scraper (YP.com)** Template. Ready.\n3.  **Add WorkFlow Name:** Update the **workflow_Name** in the Run Workflow node to match your specific BrowserAct scraping workflow.\n4.  **Activate Workflow:** Manually trigger the workflow by clicking 'Execute Workflow' to test it. For automation, replace the trigger with a `Cron` node and activate the workflow."
      },
      "typeVersion": 1
    },
    {
      "id": "e66f41b8-e129-4645-a969-fad9b7094770",
      "name": "Note autocollante - Besoin d'aide",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -640,
        496
      ],
      "parameters": {
        "width": 336,
        "height": 120,
        "content": "### Need Help?\n* #### [How to Find Your BrowseAct API Key & Workflow ID](https://www.youtube.com/watch?v=pDjoZWEsZlE)\n* #### [How to Connect n8n to Browseract](https://www.youtube.com/watch?v=RoYMdJaRdcQ)\n* #### [How to Use & Customize BrowserAct Templates](https://www.youtube.com/watch?v=CPZHFUASncY)\n* #### [How to Use the BrowserAct N8N Community Node](https://youtu.be/j0Nlba2pRLU)"
      },
      "typeVersion": 1
    },
    {
      "id": "8ebf7b39-412f-42d1-b230-f5c6344c9e3e",
      "name": "Note autocollante - Étape de scraping",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        96,
        0
      ],
      "parameters": {
        "color": 5,
        "width": 416,
        "height": 168,
        "content": "### 🌐 1. Scrape & Wait\n\n* **Run a workflow task:** This node starts your BrowserAct scraper. This is where you define what you're searching for (e.g., 'dentists' and 'Brooklyn'). You can easily change these inputs to find different types of businesses.\n\n* **Get details...:** This node pauses the workflow until the scraping is 100% complete, ensuring the next steps have all the data they need."
      },
      "typeVersion": 1
    },
    {
      "id": "6bfa6f3c-b47f-4e8f-9d2d-8b49eb52a031",
      "name": "Note autocollante - Étape de traitement",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        528,
        0
      ],
      "parameters": {
        "color": 6,
        "width": 336,
        "height": 164,
        "content": "### 🧹 2. Parse & Split Data\n\nThis **Code** node is the most critical processing step. Scrapers often return a list of results as a single block of text (a JSON string). \n\nThis code takes that string, parses it, and transforms it into separate n8n items. This correctly prepares the data for the Google Sheets node to process one row at a time."
      },
      "typeVersion": 1
    },
    {
      "id": "290deae8-3767-4144-a54b-6eee32210336",
      "name": "Note autocollante - Étape de sortie",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        880,
        384
      ],
      "parameters": {
        "color": 3,
        "width": 288,
        "content": "### 💾 3. Save to Google Sheets\n\nThis node takes each individual business lead and adds it as a new row in your sheet.\n\n**💡 Tip:** The operation is set to `appendOrUpdate` and matches on 'Company Name'. This is a great setup to prevent creating duplicate entries if you run the workflow multiple times for the same search."
      },
      "typeVersion": 1
    },
    {
      "id": "897e4af5-b6c4-43c9-9dec-3ddf5d76aee8",
      "name": "Note autocollante",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        96,
        192
      ],
      "parameters": {
        "color": 5,
        "width": 416,
        "height": 176,
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "4fa7bfe9-c045-4768-9bb6-9e5331635a50",
      "name": "Note autocollante 1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        528,
        192
      ],
      "parameters": {
        "color": 6,
        "width": 336,
        "height": 176,
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "31b49192-05ad-434b-8770-eb1bc279f607",
      "name": "Note autocollante 2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        880,
        192
      ],
      "parameters": {
        "color": 3,
        "width": 288,
        "height": 176,
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "c36f1e00-e08c-421e-b5c2-4d9f5c5e47f8",
      "name": "Note autocollante - Besoin d'aide 1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -288,
        496
      ],
      "parameters": {
        "height": 120,
        "content": "### Workflow Guidance and Showcase\n\n* #### [STOP Manual Leads! Automate Lead Gen with BrowserAct & n8n](https://www.youtube.com/watch?v=W9BHL7vok6c)"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "277b247a-08fc-41d5-8553-3f94d74b1793",
  "connections": {
    "6efa3204-54af-4b38-95a7-9996028b6166": {
      "main": [
        [
          {
            "node": "dc54c1f9-db58-48fd-92c1-45091fd18751",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "281fdee8-0b6e-4f2d-b811-7376e20c14f2": {
      "main": [
        [
          {
            "node": "35073d60-1922-4fec-a162-de41e3c3a037",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "35073d60-1922-4fec-a162-de41e3c3a037": {
      "main": [
        [
          {
            "node": "6efa3204-54af-4b38-95a7-9996028b6166",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "8ad92360-1ee6-44cb-ad18-ff1d898489b0": {
      "main": [
        [
          {
            "node": "281fdee8-0b6e-4f2d-b811-7376e20c14f2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Foire aux questions

Comment utiliser ce workflow ?

Copiez le code de configuration JSON ci-dessus, créez un nouveau workflow dans votre instance n8n et sélectionnez "Importer depuis le JSON", collez la configuration et modifiez les paramètres d'authentification selon vos besoins.

Dans quelles scénarios ce workflow est-il adapté ?

Intermédiaire - Génération de leads

Est-ce payant ?

Ce workflow est entièrement gratuit et peut être utilisé directement. Veuillez noter que les services tiers utilisés dans le workflow (comme l'API OpenAI) peuvent nécessiter un paiement de votre part.

Workflows recommandés

Informations sur le workflow
Niveau de difficulté
Intermédiaire
Nombre de nœuds15
Catégorie1
Types de nœuds5
Description de la difficulté

Adapté aux utilisateurs expérimentés, avec des workflows de complexité moyenne contenant 6-15 nœuds

Auteur
Madame AI Team | Kai

Madame AI Team | Kai

@madame-ai

I’m a PhD in Physics turned AI enthusiast, passionate about uncovering how AI is transforming content creation, business, and daily life.

Liens externes
Voir sur n8n.io

Partager ce workflow

Catégories

Catégories: 34