Add Headers to a Sheet in Excel on OneDrive

Describe the problem/error/question

When I create a workflow to add headers to an existing excel Worksheet hosted in OneDrive, I get the error below. If I manually add the headers, I can add data under the headers, but the idea is to create a new worksheet, add the headers and then add the data.

I simplified the flow to the main issue I have which is adding the headers to a new blank worksheet in Excel hosted in OneDrive.

What is the error message (if any)?

Problem in node ‘Append data to sheet‘
Cannot read properties of undefined (reading ‘match’)

Please share your workflow

Share the output returned by the last node

{
“errorMessage”: “Cannot read properties of undefined (reading ‘match’)”,
“errorDetails”: {},
“n8nDetails”: {
“n8nVersion”: “1.105.3 (Self Hosted)”,
“binaryDataMode”: “default”,
“stackTrace”: [
“TypeError: Cannot read properties of undefined (reading ‘match’)”,
" at ExecuteContext.execute (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-nodes-base@file+packages+nodes-base_@[email protected]_asn1.js@5_1af219c3f47f2a1223ec4ccec249a974/node_modules/n8n-nodes-base/nodes/Microsoft/Excel/v2/actions/worksheet/append.operation.ts:213:29)“,
" at processTicksAndRejections (node:internal/process/task_queues:105:5)”,
" at ExecuteContext.router (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-nodes-base@file+packages+nodes-base_@[email protected]_asn1.js@5_1af219c3f47f2a1223ec4ccec249a974/node_modules/n8n-nodes-base/nodes/Microsoft/Excel/v2/actions/router.ts:29:17)“,
" at ExecuteContext.execute (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-nodes-base@file+packages+nodes-base_@[email protected]_asn1.js@5_1af219c3f47f2a1223ec4ccec249a974/node_modules/n8n-nodes-base/nodes/Microsoft/Excel/v2/MicrosoftExcelV2.node.ts:26:10)”,
" at WorkflowExecute.runNode (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@[email protected]_@[email protected]_46e522f8a77ed5eccc0991bfcca21502/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:1212:9)“,
" at /usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@[email protected]_@[email protected]_46e522f8a77ed5eccc0991bfcca21502/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:1582:27”,
" at /usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@[email protected]_@[email protected]_46e522f8a77ed5eccc0991bfcca21502/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:2158:11"
]
}
}

Information on your n8n setup

  • n8n version: 1.105.3 (Self Hosted)
  • Database (default: SQLite): None
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • Operating system: Ubuntu Server

You are trying to assign null values which is giving you the error.
Ideally, this is how you should declare the code block:
Instead of declaring these values as null, declare them as empty strings.

return [
{
“id”: “”,
“serialNumber”: “”,
“deviceName”: “”,
“managedDeviceOwner”: “”,
“lastSyncDateTime”: “”,
“operatingSystem”: “”,
}
];

Hope it helps.

Hi @Adnan_Khan

Thank you for the reply. I did actually tried it like you suggested previously, but with no success.

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