OneDrive Node: "Upload" operation failing to update existing file / creating duplicates

Describe the problem/error/question

I am building a workflow to redact student names from IEP .docx files stored on OneDrive. I’m having two main issues:

  1. Binary vs. JSON Confusion: In my Compression node, n8n keeps trying to “decompress” the OneDrive URL string (JSON) instead of the actual file content (Binary). I had to add an Edit Fields node to strip away the JSON metadata just to get the files to unzip.

  2. OneDrive Update: Once I redact the files, I need to send them back to OneDrive. I’m struggling to get the OneDrive Node to “Update” the existing file instead of creating a duplicate "Upload.”

What is the error message (if any)?

In the Compression node, I was getting “item(s) exist, but they’re empty” because it was targeting the wrong data property. In the OneDrive node, I’m trying to figure out how to correctly map the File ID for an update operation.

Please share your workflow

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)

{
  "name": "IEP Redaction Workflow",
  "nodes": [
    {
      "parameters": {
        "formTitle": "Redaction Process",
        "formDescription": "Upload the zip file of IEPs",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Zip File Upload",
              "fieldType": "file",
              "requiredField": true
            },
            {
              "fieldLabel": "Teacher/classroom",
              "fieldType": "dropdown",
              "fieldOptions": {
                "values": [
                  {
                    "option": "Room 301:1bCYU7uE6ug8YYVcDlTx9M8Ysv0b10aJ4"
                  },
                  {
                    "option": "Room 302:1APD_t7VqUOSoRZBgZBG_eTtr4VDCYdlS"
                  }
                ]
              },
              "requiredField": true
            },
            {
              "fieldLabel": "Teacher email",
              "requiredField": true
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.formTrigger",
      "typeVersion": 2.3,
      "position": [
        0,
        0
      ],
      "id": "f5be60d5-0574-4375-a160-f7f9f287ceb3",
      "name": "Redaction Form",
      "webhookId": "64e27687-b348-4fb4-9251-874207735a2f"
    },
    {
      "parameters": {
        "binaryPropertyName": "Zip_File_Upload"
      },
      "type": "n8n-nodes-base.compression",
      "typeVersion": 1.1,
      "position": [
        208,
        0
      ],
      "id": "5f03deb4-589c-460a-819b-2e26a6bc0573",
      "name": "Unzip Uploaded Files "
    },
    {
      "parameters": {
        "jsCode": "// This tells the node to look specifically at the ZIP files from the previous step\nconst binaryData = $input.item.binary; \nconst result = [];\n\nfor (const key of Object.keys(binaryData)) {\n  result.push({\n    json: {\n      fileName: binaryData[key].fileName\n    },\n    binary: {\n      data: binaryData[key]\n    }\n  });\n}\n\nreturn result;"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        416,
        0
      ],
      "id": "b0a4aa6e-12b6-48a8-ad58-0d66196ba01c",
      "name": "Parse Student List"
    },
    {
      "parameters": {
        "operation": "pdf",
        "options": {
          "keepSource": "both"
        }
      },
      "type": "n8n-nodes-base.extractFromFile",
      "typeVersion": 1.1,
      "position": [
        624,
        0
      ],
      "id": "671e17c6-2a34-4f01-9c0c-5adebaa9450f",
      "name": "Extract Text from PDF"
    },
    {
      "parameters": {
        "sendTo": "={{ $('Redaction Form').item.json['Teacher email'] }}",
        "subject": "=Redacted Report Ready: {{ $('Copy file').item.json.name }}",
        "message": "=<p>The redacted IEP report has been processed and is now available in your classroom folder.</p>\n\n<p>You can access and edit the document directly on Google Drive using the link below:</p>\n\n<p>\n  <a href=\"https://docs.google.com/document/d/{{ $('Update a document').item.json.documentId }}/edit\" style=\"background-color: #4CAF50; color: white; padding: 10px 15px; text-decoration: none; border-radius: 5px; display: inline-block;\"> \n    Click Here to View Redacted Report \n  </a>\n</p>\n\n<p>This report has been automatically filed in your designated folder for review. No further action is required unless you wish to make manual edits.</p>",
        "options": {}
      },
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.1,
      "position": [
        2496,
        0
      ],
      "id": "5139eaf8-491a-43b7-94f3-c0502dc336a9",
      "name": "Email Teacher Report Link",
      "webhookId": "399ebd9f-ecfb-496c-ad4f-d9ebc7faece9",
      "credentials": {
        "gmailOAuth2": {
          "id": "b6AY4hU0wrUSkkC4",
          "name": "Gmail account"
        }
      }
    },
    {
      "parameters": {
        "modelId": {
          "__rl": true,
          "value": "models/gemini-2.5-flash",
          "mode": "list",
          "cachedResultName": "models/gemini-2.5-flash"
        },
        "messages": {
          "values": [
            {
              "content": "=Role: You are a specialized Educational Data Assistant. Your goal is to extract actionable teaching data from a student's IEP to assist in weekly lesson planning.\n\nTask: Analyze the provided IEP text and extract ONLY the Annual Goals and the Accommodations/Modifications. Maintain the educational context while strictly redacting all PII.\n\nRedaction Rules:\n\nReplace ALL student names with [STUDENT].\n\nReplace ALL school names with [SCHOOL_NAME].\n\nReplace ALL specific dates with [DATE].\n\nOutput Format: Return ONLY a valid JSON object. Do not include conversational text or markdown code blocks outside the JSON.\n\nData to Extract:\n\ngoals: Extract all Measurable Annual Goals and related objectives. Format these as a clean, bulleted Markdown list.\n\naccommodations: Extract all classroom and testing accommodations, including frequency and location. Format this as a clean Markdown table with headers: | Accommodation | Frequency | Location |.\n\nFor the accommodations key, provide a bulleted list instead of a table. Each bullet should include the accommodation name and the frequency (e.g., '* Extra time to respond | Daily').\n\nReturn your response strictly as a JSON object with the following keys:\n\ngoals: [Extract and format the goals here]\n\naccommodations: [Extract and format the accommodations here]\n\nDo not include any conversational text, only the JSON object\n\nInput Text: {{ $json.text }}"
            }
          ]
        },
        "jsonOutput": true,
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.googleGemini",
      "typeVersion": 1,
      "position": [
        832,
        0
      ],
      "id": "1cb5c42c-bb18-4e3c-ad76-cf513e0fa734",
      "name": "Message a model",
      "credentials": {
        "googlePalmApi": {
          "id": "AkPMEOYPHHVs6yOI",
          "name": "Google Gemini(PaLM) Api account"
        }
      }
    },
    {
      "parameters": {
        "mode": "runOnceForEachItem",
        "jsCode": "const response = JSON.parse($input.item.json.content.parts[0].text);\n\nreturn {\n  goals: Array.isArray(response.goals) ? response.goals.join('\\n') : response.goals,\n  accommodations: Array.isArray(response.accommodations) ? response.accommodations.join('\\n') : response.accommodations\n};;"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1184,
        0
      ],
      "id": "acfcc6a7-a74f-4f24-8d0a-417859d2d384",
      "name": "Code in JavaScript"
    },
    {
      "parameters": {
        "operation": "copy",
        "fileId": {
          "__rl": true,
          "value": "1KvsDqVyDfT0k2zN-oQCPbKONfhLoU0rP2iEkS2rQS7s",
          "mode": "list",
          "cachedResultName": "Student Info Template ",
          "cachedResultUrl": "https://docs.google.com/document/d/1KvsDqVyDfT0k2zN-oQCPbKONfhLoU0rP2iEkS2rQS7s/edit?usp=drivesdk"
        },
        "name": "={{ $('Parse Student List').item.json.fileName }}",
        "options": {}
      },
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 3,
      "position": [
        1392,
        0
      ],
      "id": "f072a6c4-de3a-4b78-966b-e9b66403b847",
      "name": "Copy file",
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "3CY8LAiQgq8wMc90",
          "name": "Google Drive account"
        }
      }
    },
    {
      "parameters": {
        "operation": "update",
        "documentURL": "={{ $node[\"Copy file\"].json[\"id\"] }}",
        "actionsUi": {
          "actionFields": [
            {
              "action": "replaceAll",
              "text": "{{goals}}",
              "replaceText": "={{ $node[\"Code in JavaScript\"].json[\"goals\"] }}"
            },
            {
              "action": "replaceAll",
              "text": "{{accommodations}}",
              "replaceText": "={{ $node[\"Code in JavaScript\"].json[\"accommodations\"] }}"
            }
          ]
        }
      },
      "type": "n8n-nodes-base.googleDocs",
      "typeVersion": 2,
      "position": [
        1600,
        0
      ],
      "id": "90793f66-7393-4f44-ab52-f3c5dabde484",
      "name": "Update a document",
      "credentials": {
        "googleDocsOAuth2Api": {
          "id": "jiLEAT3fHidPfQ9i",
          "name": "Google Docs account"
        }
      }
    },
    {
      "parameters": {
        "operation": "move",
        "fileId": {
          "__rl": true,
          "value": "={{ $node[\"Update a document\"].json.documentId }}",
          "mode": "id"
        },
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive"
        },
        "folderId": {
          "__rl": true,
          "value": "={{ $('Redaction Form').item.json[\"Teacher/classroom\"].split(':')[1] }}",
          "mode": "id"
        }
      },
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 3,
      "position": [
        1808,
        0
      ],
      "id": "6348dfe0-521b-415d-89df-5d65c71cbd87",
      "name": "Move file",
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "3CY8LAiQgq8wMc90",
          "name": "Google Drive account"
        }
      }
    },
    {
      "parameters": {
        "resource": "folder",
        "folderId": "558A44073C0F3CC0!sca2787bce2364f7593d6e5f40dcf271a"
      },
      "type": "n8n-nodes-base.microsoftOneDrive",
      "typeVersion": 1,
      "position": [
        208,
        496
      ],
      "id": "ef5f1121-b463-4b58-9a62-a251c02ec8a0",
      "name": "Get items in a folder",
      "credentials": {
        "microsoftOneDriveOAuth2Api": {
          "id": "wnHKAOfxIe1fnZ65",
          "name": "Microsoft Drive account 3"
        }
      }
    },
    {
      "parameters": {
        "operation": "copy",
        "fileId": "558A44073C0F3CC0!sec22f0cd565040e1af4ba6bb5311dc06",
        "additionalFields": {
          "name": "={{ $itemIndex + 1 }}.docx"
        },
        "parentReference": {
          "id": "558A44073C0F3CC0!sca2787bce2364f7593d6e5f40dcf271a"
        }
      },
      "type": "n8n-nodes-base.microsoftOneDrive",
      "typeVersion": 1,
      "position": [
        1248,
        288
      ],
      "id": "65016436-ebcb-4f61-a1fb-15ce1ad3f587",
      "name": "Copy a file",
      "credentials": {
        "microsoftOneDriveOAuth2Api": {
          "id": "wnHKAOfxIe1fnZ65",
          "name": "Microsoft Drive account 3"
        }
      }
    },
    {
      "parameters": {
        "binaryPropertyName": "{{ $binary.data }}",
        "outputPrefix": "extracted_"
      },
      "type": "n8n-nodes-base.compression",
      "typeVersion": 1.1,
      "position": [
        1872,
        288
      ],
      "id": "c5e2cef6-f152-4dab-b138-cc813e36e26f",
      "name": "Compression"
    },
    {
      "parameters": {
        "operation": "download",
        "fileId": "={{ $node[\"Copy a file\"].json[\"location\"].split('items/')[1].split('?')[0] }}"
      },
      "type": "n8n-nodes-base.microsoftOneDrive",
      "typeVersion": 1,
      "position": [
        1456,
        288
      ],
      "id": "d616bd1d-001e-4d98-b453-7c494f3255b3",
      "name": "Download a file",
      "credentials": {
        "microsoftOneDriveOAuth2Api": {
          "id": "wnHKAOfxIe1fnZ65",
          "name": "Microsoft Drive account 3"
        }
      }
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "a2a9c645-6abd-4bf9-8125-2c0c2080b852",
              "name": "data",
              "value": "data",
              "type": "binary"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        1664,
        288
      ],
      "id": "0ecc8c7a-4994-4e66-a98e-cfa27e5eb896",
      "name": "Edit Fields"
    }
  ],
  "pinData": {},
  "connections": {
    "Redaction Form": {
      "main": [
        [
          {
            "node": "Unzip Uploaded Files ",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Unzip Uploaded Files ": {
      "main": [
        [
          {
            "node": "Parse Student List",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse Student List": {
      "main": [
        [
          {
            "node": "Extract Text from PDF",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Text from PDF": {
      "main": [
        [
          {
            "node": "Message a model",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Message a model": {
      "main": [
        [
          {
            "node": "Code in JavaScript",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code in JavaScript": {
      "main": [
        [
          {
            "node": "Copy file",
            "type": "main",
            "index": 0
          },
          {
            "node": "Copy a file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Email Teacher Report Link": {
      "main": [
        []
      ]
    },
    "Copy file": {
      "main": [
        [
          {
            "node": "Update a document",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update a document": {
      "main": [
        [
          {
            "node": "Move file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Move file": {
      "main": [
        [
          {
            "node": "Email Teacher Report Link",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Copy a file": {
      "main": [
        [
          {
            "node": "Download a file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download a file": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "Compression",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1",
    "saveDataErrorExecution": "none",
    "saveDataSuccessExecution": "none",
    "saveManualExecutions": false,
    "callerPolicy": "workflowsFromSameOwner",
    "availableInMCP": false
  },
  "versionId": "aefe0bdc-5cc3-4d94-8ae2-dc4d65305964",
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "6975021a84a3ee4bf29131c29e08fa755aa8534a2aa34b1c696e4a51a3ea39e6"
  },
  "id": "5YR3DhlTizu0TfWT",
  "tags": []
}

Share the output returned by the last node

The item has no binary field ‘{{ $binary.data }}’ [item 0]
Check that the parameter where you specified the input binary field name is correct, and that it matches a field in the binary input

Information on your n8n setup

  • n8n version: 1.122.4
  • Database (default: SQLite): default
  • n8n EXECUTIONS_PROCESS setting (default: own, main): default
  • Running n8n via (Docker, npm, n8n cloud, desktop app): docker/ngrok
  • Operating system: Windows 11

hey! yeah this is a common pain point with OneDrive in n8n. let me break down both issues:

## Issue 1: Binary vs JSON in Compression

the problem is that OneDrive node outputs the file data in a specific structure. when you’re passing it to Compression, you need to make sure you’re targeting the actual binary file data, not the metadata.

**quick fix:**

- in your Compression node, under “Input Data Property Path”, make sure you’re pointing to `data` (or whatever property contains the actual file binary)

- if the OneDrive node is outputting something like `{ data: {…}, metadata: {…} }`, you need to tell Compression to decompress specifically from the `data` property

you might not even need the Edit Fields node if you just set the input property path correctly. try setting it to just `data` and see if that helps.

## Issue 2: OneDrive Upload vs Update

this one trips people up. the OneDrive node has separate operations - “Upload” creates/overwrites, but for updating an *existing* file you typically need:

**the setup:**

1. use the **“Update”** operation (not Upload) in the OneDrive node

2. you need to provide the **File ID** of the existing file you’re updating

3. that File ID comes from your initial OneDrive query that fetched the file

**how to get the File ID:**

- when you first read from OneDrive (List Files, Get File, etc), the output includes an `id` field

- pass that `id` directly to the Update operation as the “File ID” input

- then provide your redacted file content as the “File” input

**example structure:**

```json

{

“fileId”: “{{ $json.id }}”,

“file”: “{{ $binary.data }}”

}

```

the key thing: **you must have captured the original file’s ID from the initial OneDrive read**. if you lost that, you’ll have to query for it again using Search or List Files with a name filter.

**pro tip:** if you’re looping through multiple files, make sure the file ID carries through each iteration. sometimes it gets lost if you’re not mapping your data correctly between nodes.

post your workflow json or a screenshot of how you’re currently mapping the File ID and i can spot whats going wrong. also - what OneDrive operation are you using in your initial read? (Get File, List Files, Search, etc?)

When I have tried to find anything that says update it does not exist in my n8n for onedrive. Idk if it’s because I am running an older version or what.

hi @Jonathan_Wilson

You’re not missing anything — this is a version limitation.
In older n8n versions, the OneDrive node does not expose a separate “Update” operation.

In those versions, the only way to replace a file is:

  • Use Upload
  • Provide the existing file ID as the target

If you upload without the file ID, OneDrive will always create a duplicate.

Newer n8n versions make this behavior clearer, but the underlying rule is the same: updating requires the original file ID.

If updating OneDrive files is a core part of your workflow, upgrading n8n is strongly recommended — the node behavior and UI are much clearer in newer releases.