Automated Web Scraping email a CSV, save to Google Sheets & Microsoft Excel

Source

https://n8n.io/workflows/2275-automated-web-scraping-email-a-csv-save-to-google-sheets-and-microsoft-excel/

Template

{
  "id": "swaWgPkq0xW1Jk0o",
  "meta": {
    "instanceId": "615d41e094941c09198b8ce125ed214047535a66e1c0b3e0cb2d688b4f5c9651"
  },
  "name": "Automated Web Scraping: email a CSV, save to Google Sheets & Microsoft Excel",
  "tags": [],
  "nodes": [
    {
      "id": "c3ef40df-084e-435c-9a11-3aa0a2f94f36",
      "name": "When clicking \"Test workflow\"",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        380,
        540
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "e0583472-a450-4582-83bc-84a014bea543",
      "name": "Split Out",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        1040,
        540
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "books"
      },
      "typeVersion": 1
    },
    {
      "id": "f9cbdb05-c249-4ccb-b3c5-f2eb8861f811",
      "name": "Convert to CSV File",
      "type": "n8n-nodes-base.convertToFile",
      "position": [
        1820,
        540
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.1
    },
    {
      "id": "1ecb45ee-659e-42a9-919d-6a3ebed0b836",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1620,
        100
      ],
      "parameters": {
        "height": 184.90255200662574,
        "content": "### You need to setup Microsoft Azure credentials with Microsoft Graph permissions."
      },
      "typeVersion": 1
    },
    {
      "id": "1d4bcfad-feae-4317-9012-7e03a6203d91",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1900,
        100
      ],
      "parameters": {
        "height": 183.1237982918667,
        "content": "### Unlike Google Sheets where we did not need to have a certain format, here we need to create the column headers, otherwise the appending to the sheet won't work."
      },
      "typeVersion": 1
    },
    {
      "id": "4248ddb3-11c0-41e3-be81-ce4ec92923ee",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2020,
        740
      ],
      "parameters": {
        "height": 135.09744799337426,
        "content": "### For these steps to work you will need to have Drive, Sheets and Gmail APIs enabled in your Google Cloud Account"
      },
      "typeVersion": 1
    },
    {
      "id": "d17174fe-8015-453a-b439-43eb3245d7cb",
      "name": "Extract all books from the page",
      "type": "n8n-nodes-base.html",
      "position": [
        820,
        540
      ],
      "parameters": {
        "options": {},
        "operation": "extractHtmlContent",
        "extractionValues": {
          "values": [
            {
              "key": "books",
              "cssSelector": ".row > li",
              "returnArray": true,
              "returnValue": "html"
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "5de66b0a-9138-42e3-857a-3060c71776a9",
      "name": "Sort by price",
      "type": "n8n-nodes-base.sort",
      "position": [
        1480,
        540
      ],
      "parameters": {
        "options": {},
        "sortFieldsUi": {
          "sortField": [
            {
              "order": "descending",
              "fieldName": "price"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "b8c539ce-292c-4b67-83b2-b397cfc5bb97",
      "name": "Extract individual book price",
      "type": "n8n-nodes-base.html",
      "position": [
        1260,
        540
      ],
      "parameters": {
        "options": {},
        "operation": "extractHtmlContent",
        "dataPropertyName": "books",
        "extractionValues": {
          "values": [
            {
              "key": "title",
              "attribute": "title",
              "cssSelector": "h3 > a",
              "returnValue": "attribute"
            },
            {
              "key": "price",
              "cssSelector": ".price_color"
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "b8aa573d-5b63-4669-900f-bcc915b6ad41",
      "name": "Save to Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1820,
        760
      ],
      "parameters": {
        "columns": {
          "value": {},
          "schema": [
            {
              "id": "title",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "title",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "price",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "price",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "autoMapInputData",
          "matchingColumns": []
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1zyiRT7iIlfzZiskC9vDVoAFnW_UNMVXX0-ESVU1yYxY/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1zyiRT7iIlfzZiskC9vDVoAFnW_UNMVXX0-ESVU1yYxY",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1zyiRT7iIlfzZiskC9vDVoAFnW_UNMVXX0-ESVU1yYxY/edit?usp=drivesdk",
          "cachedResultName": "Scraped Data"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "MMrGJCEKCWIb8jPE",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "97bdbc85-84b3-4463-9b98-5d40b80a3a1a",
      "name": "Save to Microsoft Excel 365",
      "type": "n8n-nodes-base.microsoftExcel",
      "position": [
        1820,
        320
      ],
      "parameters": {
        "options": {},
        "dataMode": "autoMap",
        "resource": "worksheet",
        "workbook": {
          "__rl": true,
          "mode": "id",
          "value": "=EA8A73F11507ECE9!24392"
        },
        "operation": "append",
        "worksheet": {
          "__rl": true,
          "mode": "list",
          "value": "{00000000-0001-0000-0000-000000000000}",
          "cachedResultName": "Sheet1"
        }
      },
      "credentials": {
        "microsoftExcelOAuth2Api": {
          "id": "oSGTo5qjZHVXYiuB",
          "name": "Microsoft Excel account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "4078dc06-0497-4579-a6f4-8c314307aab8",
      "name": "Send CSV via e-mail",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2040,
        540
      ],
      "parameters": {
        "sendTo": "[email protected]",
        "message": "Hey, here's the scraped data from the online bookstore!",
        "options": {
          "attachmentsUi": {
            "attachmentsBinary": [
              {}
            ]
          }
        },
        "subject": "bookstore csv"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "18u7JrVfJgM0fhOv",
          "name": "Gmail account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "8ddca560-8da7-4090-b865-0523f95ca463",
      "name": "Fetch website content",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        600,
        540
      ],
      "parameters": {
        "url": "http://books.toscrape.com",
        "options": {
          "allowUnauthorizedCerts": true
        }
      },
      "typeVersion": 4.1
    },
    {
      "id": "450020e6-9f43-4652-be13-25cb5eb3584c",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        360,
        60
      ],
      "parameters": {
        "width": 579,
        "height": 297,
        "content": "## Automated Web Scraping: email a CSV, save to Google Sheets & Microsoft Excel\n\nSet-up steps:\n1. Change the website to scrape in the \"Fetch website content\" node\n2. Configure Microsoft Azure credentials with Microsoft Graph permissions (required for the Save to Microsoft Excel 365 node)\n3. Configure Google Cloud credentials with access to Google Drive, Google Sheets and Gmail APIs (the latter is required for the Send CSV via e-mail node)."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "27818544-3070-4201-917d-83739ce75339",
  "connections": {
    "Split Out": {
      "main": [
        [
          {
            "node": "Extract individual book price",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Sort by price": {
      "main": [
        [
          {
            "node": "Save to Microsoft Excel 365",
            "type": "main",
            "index": 0
          },
          {
            "node": "Convert to CSV File",
            "type": "main",
            "index": 0
          },
          {
            "node": "Save to Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert to CSV File": {
      "main": [
        [
          {
            "node": "Send CSV via e-mail",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch website content": {
      "main": [
        [
          {
            "node": "Extract all books from the page",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract individual book price": {
      "main": [
        [
          {
            "node": "Sort by price",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking \"Test workflow\"": {
      "main": [
        [
          {
            "node": "Fetch website content",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract all books from the page": {
      "main": [
        [
          {
            "node": "Split Out",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

© 2025 AW

Instagram 𝕏 GitHub