mimeType Issue in Google Drive > File > Upload Node

Hello everyone,

I am experiencing an issue with the Google Drive > File > Upload node in N8n.

When I upload a CSV file, which is converted from the previous node Convert to File > CSV, the mimeType is automatically changed from text/csv to application/octet-stream during the upload process.

This causes problems for the usage of the file, as it is no longer recognized as a CSV file in Google Drive.
While the file copy works perfectly, the only issue is the mimeType. As a result, when I click on the file in MyDrive, it does not open directly but forces a download to the local machine.
In the file details, it shows Type: Binary File instead of Type: Comma-separated values.

Here are the details of the workflow:

  • Node used: Google Drive > File > Upload
  • Expected mimeType: text/csv
  • mimeType after upload: application/octet-stream

Have you encountered this problem before, or do you know how to force the mimeType to remain as text/csv during the upload?

Thank you in advance for your help!

Additional Info Requested

  • n8n version: 1.54.4
  • Database: SQLite
  • n8n EXECUTIONS_PROCESS setting: regular
  • Running n8n via: npm
  • Operating system: macOS

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Welcome to the community @Guillaume_Braillon !

Tip for sharing information

Pasting your n8n workflow


Ensure to copy your n8n workflow and paste it in the code block, that is in between the pairs of triple backticks, which also could be achieved by clicking </> (preformatted text) in the editor and pasting in your workflow.

```
<your workflow>
```

That implies to any JSON output you would like to share with us.


I ran your workflow (using your n8n version and the latest version locally) and encountered no such issue.

Thank you for testing the workflow.

I’m still facing the issue and not sure what else to check on my side. Could you suggest what I should look into to resolve the mimeType issue? Any advice would be appreciated!

Thanks again!

Hello,
I’m still facing the issue and not sure what else to check on my side. I’ve updated N8n to the latest version (1.61.0), but the mimeType still changes to application/octet-stream.

I continue to investigate the cause of the mimeType change. Could this be related to a configuration on the Google API side? I’ve looked into whether it’s possible to select mimeTypes during the upload, but haven’t found anything conclusive

Thanks again for your help!

I just tested with other formats, and I found that the issue occurs with *.xls files but not with *.xlsx files.

All three still work for me just fine, no changes to MIME type. I guess it is something on your Google Drive that applies changes. Not sure what else I can do.

Ok tks, i’ll keep on trying.

I’m almost there, keeping my hopes up! :wink:

Using an HTTP Request node to make a POST request to the Google Drive API successfully creates the file with the correct mimeType.
I conclude that, for some unknown reason, the Google Drive node does not send the mimeType.

However, I encounter another problem: I cannot retrieve the binary file in the body of my HTTP Request node. I end up with [object Object]. I’ve tried many things without success.

In summary, I have the correct mimeType but not the content with the HTTP Request node, and I have the content but not the correct mimeType with the Google Drive node. :joy:

Could someone give me the little tip to retrieve the content of my binary file in the body?

For your information, I tested copying the content of the CSV in the body, and it works, so I’m not missing much.

--n8n_boundary
Content-Type: application/json; charset=UTF-8

{
  "name": "{{ $binary.data.fileName }}",
  "mimeType": "{{ $binary.data.mimeType }}"
}

--n8n_boundary
Content-Type: {{ $binary.data.mimeType }}	

First Name,Last Name,Company,Email,Language,Country,Job
Alice,Dupont,TechCorp,[email protected],French,France,Software Engineer
John,Smith,WebSolutions,[email protected],English,United States,Web Developer
Maria,Garcia,InnovateTech,[email protected],Spanish,Spain,Project Manager
Ahmed,Khan,GlobalSoft,[email protected],Arabic,United Arab Emirates,Data Analyst
Sophie,Müller,DevExperts,[email protected],German,Germany,UI/UX Designer
--n8n_boundary--

Thank you in advance! :pray:
Guillaume.

I faced the same issue and solved it by using your HTTP Request example, encoding the binary file in base64.

1 Like

is N8N_DEFAULT_BINARY_DATA_MODE set to filesystem? if not, can you please try setting it, restarting the instance, and then try the workflow again?

I’m using N8N cloud and it’s seems that we are not allowed to change that setting.

Indeed, with the cloud version, it is not possible to modify environment variables, including N8N_DEFAULT_BINARY_DATA_MODE.

.

Great, thank you, it works very well!

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