Writing data to an Excel Spreadsheet (Using the MS Excel node)

I am trying to write data to an excel spreadsheet (saved in my OneDrive). I am connect to the workbook, see the worksheet and table in n8n. I can’t work out who to write the data though. I’ve looked through the doco but can’t find any specific information.

I get the following error

Please share the workflow

{
  "name": "My workflow",
  "nodes": [
    {
      "parameters": {},
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "typeVersion": 1,
      "position": [
        240,
        300
      ]
    },
    {
      "parameters": {
        "keepOnlySet": true,
        "values": {
          "string": [
            {
              "name": "Name",
              "value": "={{$json[\"properties\"][\"firstname\"][\"value\"]}} {{$json[\"properties\"][\"lastname\"][\"value\"]}}"
            },
            {
              "name": "Email",
              "value": "={{$json[\"identity-profiles\"][0][\"identities\"][0][\"value\"]}}"
            }
          ]
        },
        "options": {}
      },
      "name": "Set",
      "type": "n8n-nodes-base.set",
      "position": [
        900,
        -20
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "functionCode": "var newItems = [];\nnewItems.push({json:{\n    \"addedAt\": 1606827045601,\n    \"vid\": 1,\n    \"canonical-vid\": 1,\n    \"merged-vids\": [],\n    \"portal-id\": 8924380,\n    \"is-contact\": true,\n    \"profile-token\": \"AO_T-mMZqmgHPI5CLLlw2qE24AlgWOJUL0LdMb2CegxeMzQK1LXyh7iZAgjNd-00ZdPAfnFU9Lv_7nq6qlrKvfAh8hr_cw-VBH1RCCMgHHYQ06DOXoIGAlViWmMKY-0lF9dv7lBVOMf5\",\n    \"profile-url\": \"https://app.hubspot.com/contacts/8924380/contact/1\",\n    \"properties\": {\n      \"firstname\": {\n        \"value\": \"Maria\"\n      },\n      \"lastmodifieddate\": {\n        \"value\": \"1606827057310\"\n      },\n      \"company\": {\n        \"value\": \"HubSpot\"\n      },\n      \"lastname\": {\n        \"value\": \"Johnson (Sample Contact)\"\n      }\n    },\n    \"form-submissions\": [],\n    \"identity-profiles\": [\n      {\n        \"vid\": 1,\n        \"saved-at-timestamp\": 1606827045478,\n        \"deleted-changed-timestamp\": 0,\n        \"identities\": [\n          {\n            \"type\": \"EMAIL\",\n            \"value\": \"[email protected]\",\n            \"timestamp\": 1606827045444,\n            \"is-primary\": true\n          },\n          {\n            \"type\": \"LEAD_GUID\",\n            \"value\": \"cfa8b21f-164e-4c9a-aab1-1235c81a7d26\",\n            \"timestamp\": 1606827045475\n          }\n        ]\n      }\n    ],\n    \"merge-audits\": []\n  }});\nnewItems.push({json:{\n    \"addedAt\": 1606827045834,\n    \"vid\": 51,\n    \"canonical-vid\": 51,\n    \"merged-vids\": [],\n    \"portal-id\": 8924380,\n    \"is-contact\": true,\n    \"profile-token\": \"AO_T-mMX1jbZjaachMJ8t1F2yRdvyAvsir5RMvooW7XjbPZTdAv8hc24U0Rnc_PDF1gp1qmc8Tg2hDytOaRXRiWVyg-Eg8rbPFEiXNdU6jfMneow46tsSiQH1yyRf03mMi5ALZXMVfyA\",\n    \"profile-url\": \"https://app.hubspot.com/contacts/8924380/contact/51\",\n    \"properties\": {\n      \"firstname\": {\n        \"value\": \"Brian\"\n      },\n      \"lastmodifieddate\": {\n        \"value\": \"1606827060106\"\n      },\n      \"company\": {\n        \"value\": \"HubSpot\"\n      },\n      \"lastname\": {\n        \"value\": \"Halligan (Sample Contact)\"\n      }\n    },\n    \"form-submissions\": [],\n    \"identity-profiles\": [\n      {\n        \"vid\": 51,\n        \"saved-at-timestamp\": 1606827045720,\n        \"deleted-changed-timestamp\": 0,\n        \"identities\": [\n          {\n            \"type\": \"EMAIL\",\n            \"value\": \"[email protected]\",\n            \"timestamp\": 1606827045444,\n            \"is-primary\": true\n          },\n          {\n            \"type\": \"LEAD_GUID\",\n            \"value\": \"d3749acc-06e1-4511-84fd-7b0d847f6eff\",\n            \"timestamp\": 1606827045717\n          }\n        ]\n      }\n    ],\n    \"merge-audits\": []\n  } });\nreturn newItems;"
      },
      "name": "Mock data (CRM Contacts)",
      "type": "n8n-nodes-base.function",
      "position": [
        700,
        -20
      ],
      "notesInFlow": true,
      "typeVersion": 1,
      "notes": "\"Get contacts\" data from Hubspot node. "
    },
    {
      "parameters": {
        "resource": "table",
        "workbook": "01SX35NVFM6A6HU24OKBAYX63MQP7IETD2",
        "worksheet": "{A266F824-A9D5-43B3-802E-3DF34783BF7C}",
        "table": "{4A34212A-755E-4841-977F-4F776A75D271}",
        "additionalFields": {
          "index": 0
        }
      },
      "name": "Microsoft Excel",
      "type": "n8n-nodes-base.microsoftExcel",
      "typeVersion": 1,
      "position": [
        1120,
        -20
      ],
      "credentials": {
        "microsoftExcelOAuth2Api": {
          "id": "2",
          "name": "Microsoft Excel account"
        }
      }
    }
  ],
  "connections": {
    "Set": {
      "main": [
        [
          {
            "node": "Microsoft Excel",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Mock data (CRM Contacts)": {
      "main": [
        [
          {
            "node": "Set",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Microsoft Excel": {
      "main": [
        []
      ]
    },
    "Start": {
      "main": [
        [
          {
            "node": "Mock data (CRM Contacts)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {}
}```

## Share the output returned by the last node
<!-- If you need help with transforming the data, please also share the expected output -->

## Information on your n8n setup
- **n8n version:0.152.0**
- **Database you're using (default: SQLite): DEFAULT**
- **Running n8n with the execution process [own(default), main]: DEFAULT**
- **Running n8n via [Docker, npm, n8n.cloud, desktop app]: DOCKER**

Hi @Matt_W, welcome to the community :tada:

I’m sorry to hear you’re having trouble here. This error is however coming from Microsoft Excel online (and only shown in n8n), so the root cause likely lives outside n8n. From quickly searching the error I came across this post on Microsoft’s community:

Would you be able to check you have defined any other tables around the table you’re trying to insert data into on your sheet?

Hi @MutedJam, thanks for the welcome and reply! I didn’t have any other tables but think something funky happened with how I initially created it. I deleted the XLSX doc and recreated everything which seemed to fix the problem. It could have had something to do with me selecting the entire columns when creating the table.

1 Like

Awesome, I’m glad to hear it’s working now. Thanks for reporting back and sorry for the trouble in the first place! I’ve added Excel Online to my list of things to look closer into going forward, so hopefully I’ll be able to provide a bit more advice on this going forward :slight_smile:

1 Like