Unable to upload word document (.doc and .docx) files to google drive

Issue: Google Drive Upload Changes .docx to .zip Despite Correct MIME Type in n8n Workflow

Hello everyone,
I’m encountering an issue in n8n where I’m building a flow to automate uploading documents sent via Telegram into Google Drive. The flow works functionally — the files are uploaded — but there’s a critical inconsistency: files like .docx are being uploaded and saved as ZIP archives in Google Drive instead of as proper Word documents.

Despite setting the correct filename and MIME type, Google Drive seems to ignore or override them.

Flow Breakdown
Here’s the structure of my current n8n workflow:

  1. Telegram Trigger
    User sends a .docx file to the Telegram bot.

Telegram provides file_id and file_name, but the MIME type is usually set to application/octet-stream.

  1. HTTP Request — Get File Path

https://api.telegram.org/bot/getFile?file_id={{ $(‘Telegram Trigger’).item.json.message.document.file_id }}

  1. HTTP Request — Download Binary

https://api.telegram.org/file/bot/{{ $json.result.file_path }}

  1. Code Node — Move and Fix Binary Data
    Here’s the code I use to:

Determine the MIME type based on file extension

Move the binary from data to file

Explicitly set fileName and mimeType

const mimeTypesByExtension = {
docx: ‘application/vnd.openxmlformats-officedocument.wordprocessingml.document’,
doc: ‘application/msword’,
pdf: ‘application/pdf’,
// other types omitted for brevity
};

items.forEach(item => {
const filePath = item.json?.result?.file_path || ‘’;
const fileName = filePath.split(‘/’).pop() || ‘’;
const fileExt = fileName.split(‘.’).pop().toLowerCase();
let mimeType = mimeTypesByExtension[fileExt] || ‘application/octet-stream’;

item.json.mimeType = mimeType;

if (item.binary?.data) {
item.binary.file = {
…item.binary.data,
fileName: fileName,
mimeType: mimeType,
};
delete item.binary.data;
}
});

return items;

  1. Google Drive Node — Upload File
    The file uploads to Google Drive successfully. But…

The Problem
In Google Drive, the uploaded file appears as:

Name: document.docx :white_check_mark:
MimeType: application/x-zip :cross_mark:
When opened: Drive treats it as a ZIP file, not a Word document.
Even though:
The .docx file is valid when downloaded directly in n8n (via Write Binary File).
The MIME is explicitly set in the binary object and passed to the Google Drive node.
I’ve tested hardcoding the MIME in the Google Drive node with no success.

this is what I’m getting after uploading

Hi there, i tried reproducing your workflow, sent a docx file to telegram, download the file, upload it to gdrive

i dont do any configuration of the mimetype and it works just fine
here’s the code

{
  "nodes": [
    {
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "type": "n8n-nodes-base.telegramTrigger",
      "typeVersion": 1.2,
      "position": [
        0,
        0
      ],
      "id": "61c8c02c-3735-4419-a288-e49cf9872577",
      "name": "Telegram Trigger",
      "webhookId": "8f9c35aa-11bb-4062-bdf6-db1a79cae50a",
      "credentials": {
        "telegramApi": {
          "id": "kyioSsB2T0kGd1t7",
          "name": "Telegram account"
        }
      }
    },
    {
      "parameters": {
        "resource": "file",
        "fileId": "={{ $json.message.document.file_id }}"
      },
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        220,
        0
      ],
      "id": "5cac6080-1b87-44a6-812c-ec4da84835f2",
      "name": "Telegram",
      "webhookId": "e58e2f85-69b7-4b68-bb16-708a7e3db805",
      "credentials": {
        "telegramApi": {
          "id": "kyioSsB2T0kGd1t7",
          "name": "Telegram account"
        }
      }
    },
    {
      "parameters": {
        "name": "test",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive"
        },
        "folderId": {
          "__rl": true,
          "value": "13ez0dVwrwDhRXfgzhU1SHeSLY6LNuX4v",
          "mode": "list",
          "cachedResultName": "axa",
          "cachedResultUrl": "https://drive.google.com/drive/folders/13ez0dVwrwDhRXfgzhU1SHeSLY6LNuX4v"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 3,
      "position": [
        440,
        0
      ],
      "id": "bce47627-743b-4691-92a1-6f565523c6b8",
      "name": "Google Drive",
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "a59x36Q1r2vK2xRI",
          "name": "Google Drive account"
        }
      }
    }
  ],
  "connections": {
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "Telegram",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram": {
      "main": [
        [
          {
            "node": "Google Drive",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {
    "Telegram Trigger": [
      {
        "update_id": 40799810,
        "message": {
          "message_id": 42,
          "from": {
            "id": 5653284151,
            "is_bot": false,
            "first_name": "Fahmi",
            "last_name": "Fahreza",
            "username": "fahmiiirezaa",
            "language_code": "en"
          },
          "chat": {
            "id": 5653284151,
            "first_name": "Fahmi",
            "last_name": "Fahreza",
            "username": "fahmiiirezaa",
            "type": "private"
          },
          "date": 1748761076,
          "document": {
            "file_name": "Fahmi Invoice May 2025.docx",
            "mime_type": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
            "file_id": "BQACAgUAAxkBAAMqaDv59HfhdAm6ZSnPK8XQXoqju2gAAlkUAALZS-BVqp6CyRocnY42BA",
            "file_unique_id": "AgADWRQAAtlL4FU",
            "file_size": 283815
          },
          "caption": "test docs"
        }
      }
    ]
  },
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "e31766f2fca5112b02da6c79822708ea3a37035a99edaea8569770548dfad53d"
  }
}```

here’s the image of the workflow

Hi,

Thanks for your response

I tried the same, but not working as expected in Telegram and WhatsApp both

{
“name”: “My workflow 9”,
“nodes”: [
{
“parameters”: {
“updates”: [
“message”
],
“additionalFields”: {}
},
“type”: “n8n-nodes-base.telegramTrigger”,
“typeVersion”: 1.2,
“position”: [
60,
40
],
“id”: “8b5317ec-d081-41e6-836b-b04eab2f1561”,
“name”: “Telegram Trigger1”,
“webhookId”: “8f9c35aa-11bb-4062-bdf6-db1a79cae50a”,
“credentials”: {
“telegramApi”: {
“id”: “A80nQEH05kSvur00”,
“name”: “Telegram Credentials”
}
}
},
{
“parameters”: {
“resource”: “file”,
“fileId”: “={{ $json.message.document.file_id }}”
},
“type”: “n8n-nodes-base.telegram”,
“typeVersion”: 1.2,
“position”: [
240,
40
],
“id”: “52db4a43-7178-4cc0-a56b-dd36facdcd2c”,
“name”: “Telegram1”,
“webhookId”: “e58e2f85-69b7-4b68-bb16-708a7e3db805”,
“credentials”: {
“telegramApi”: {
“id”: “A80nQEH05kSvur00”,
“name”: “Telegram Credentials”
}
}
},
{
“parameters”: {
“name”: “test”,
“driveId”: {
“__rl”: true,
“mode”: “list”,
“value”: “My Drive”
},
“folderId”: {
“__rl”: true,
“value”: “1lFZDxafw3C87F5eyN4AdlV4PO”,
“mode”: “list”,
“cachedResultName”: “Candidate Resumes”,
“cachedResultUrl”: “https://drive.google.com/drive/folders/1lFZDxafw3C87F5eyN4AdlVPO
},
“options”: {}
},
“type”: “n8n-nodes-base.googleDrive”,
“typeVersion”: 3,
“position”: [
460,
40
],
“id”: “1592b61a-bf84-4eeb-ba70-ba06a531ff85”,
“name”: “Google Drive1”,
“credentials”: {
“googleDriveOAuth2Api”: {
“id”: “osyTyiJ8rNgIWjI2”,
“name”: “Google Drive account”
}
}
}
],
“pinData”: {},
“connections”: {
“Telegram Trigger1”: {
“main”: [
[
{
“node”: “Telegram1”,
“type”: “main”,
“index”: 0
}
]
]
},
“Telegram1”: {
“main”: [
[
{
“node”: “Google Drive1”,
“type”: “main”,
“index”: 0
}
]
]
}
},
“active”: false,
“settings”: {
“executionOrder”: “v1”
},
“versionId”: “5a04381f-380c-46db-876b-9eb5804c1586”,
“meta”: {
“templateCredsSetupCompleted”: true,
“instanceId”: “59760ea4595f7afdd3f1387435f88c580b31d649a1087bb5b6b438778e171ff7”
},
“id”: “lMp1WJdoTLKd26ur”,
“tags”:
}

This is my flow

This is what it saved


I’m currently using the free cloud version of n8n (Version 1.94.1). If everything works as expected, especially with the workflows, I plan to upgrade to a paid monthly plan.

My top priority right now is handling WhatsApp messages—I need to automatically upload incoming files (PDF, DOC, and DOCX formats) as they are received.

hmm, yea, the only difference from our workflow is, i do not use the cloud version, but i self host it, same version 1.94.1

Hi,

Any solution to this or any advice?