Converting document when uploading to Google Drive

Hi

I have a Excel file that I would like to upload to Google Drive and have converted to a Google Sheet document. I don’t want the original Excel file in the drive at all.

I see that it is possible through their API to convert to the special google formats: Upload file data  |  Google Drive API  |  Google Developers, but the Google Drive node doesn’t support it.

The node seems to have its own client implementation instead of using Google’s libraries which makes it a bit too much of a hurdle to come up with a patch myself. I hope someone can implement it though :slight_smile:

@jan Hey, who should I talk to get this feature request triaged?

Hey @trygvis,

Do upvote the feature request. The more votes and interest it gets from the community, the higher the priority!

But the question has already moved off the front-page, how are people ever going to find it and vote for it? Or get the attention of the developers?

I’m not trying to impose/force my issue on the developers, I just want to know if it makes sense/can be done.

I would say it makes sense and it can be done… it is only software after all.

What tends to happen from what I have seen is if someone else mentions it someone will do a quick search and link to it then it will get a vote.

Looking at GoogleDrive.node.ts the change doesn’t look like it would be too bad, Would you like a free text field for it or a drop down where you can set the document type?

Hi @Jon, thanks for taking a look! It seems like a pretty easy fix.

I think a drop-down would make the most sense, I doubt they will add many more documents in the future. I also rather say “Google Docs” instead of their media type.

It is important that I also can change the value dynamically, as have one case where I receive many files and don’t know their file type up front. Is that also possible with a drop-down?

1 Like

Like an auto option to try and work it out from the file extension :thinking: I like the idea, I have a couple of tweaks that I want to make to the Xero node first but if no one else gets to it I may take a stab at it as it will be useful for some of the bits I want to do in the future as well with CSV files.

I think a drop-down would make the most sense, I doubt they will add many more documents in the future. I also rather say “Google Docs” instead of their media type.

You can load all the media types from the about resource. Or, you can copy them from file:list

It is important that I also can change the value dynamically, as have one case where I receive many files and don’t know their file type up front. Is that also possible with a drop-down?

You can set values dynamically using expressions.

It seems like a pretty easy fix.

Adding the new parameter and changing this line for this.getNodeParameter('mimeType', i) || mimeType, should do it.

1 Like

Auto-option might be nice, but there are multiple possible mappings (some making more sense than others), so I’m not quite sure what would the best for the users in the end.

As @RicardoE105 noticed, the target media type list can at least be pre-populated from their API. If the known types are given friendly names (“Google Sheets” instead of “application/vnd.google-apps.spreadsheet”) it should be quite user friendly too.

I was thinking of friendly names in the drop down expecting people to know the actual mime type would be crazy.

I think the biggest issue will be automatically working out what the type should be. Google do list what each extension maps to but I think a couple can have different options so maybe an expression using a case / switch would be the best win.

I was going to say that there are multiple options for each format, but looking more closely that only applies to plain text:

So the only question is how to map plain text. These are the alternatives I can think of:

  • Always Google Doc: probably ok. if one want it to be a google sheet you most likely have csv data anyway and can use that media type.
  • Always fail.
  • Node configuration to either select one or the other.

That was the list I was looking at, So I was thinking cheat and have an “Auto” option which would just set the Office type document formats to the Google version, Leave Images and plain text / json as their normal option then if needed allow it to be set manually with an expression or something.