Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Push flag "-convert" has no effect #232

Open
Andrew-Dickinson opened this issue Jun 15, 2015 · 16 comments
Open

Push flag "-convert" has no effect #232

Andrew-Dickinson opened this issue Jun 15, 2015 · 16 comments

Comments

@Andrew-Dickinson
Copy link

According to the readme documentation, the "convert" flag is supposed to convert a file to its native google doc format. It seems to have no effect when used with the following xls file:

https://drive.google.com/file/d/0B_KcvpELW9SYNVBmM1JiOG5rQzQ/view?usp=sharing

Or its xlsx equivalent:
https://drive.google.com/file/d/0B_KcvpELW9SYcnhYR01oVm15aXM/view?usp=sharing

The flag seems to have no effect in either case. What am I doing wrong?

@odeke-em
Copy link
Owner

Hello again @smarthimandrew. Thank you for reporting this. I'll take a look at it in about 9 hours when I get back home.

@odeke-em
Copy link
Owner

As far as I can investigate, the flag is correctly passed into the Google API client and even sent well with the URL parameters. I'll check with the team working on the API client if there is anything more needed.

@canpolat
Copy link

Hi,

Any news on this? I observe similar behavior with a CSV file of mine. It just uploads the file with .csv extension and Drive thinks it's a .doc (it tries to open it with Google Documents).

@Andrew-Dickinson
Copy link
Author

Nope. I just used a different approach for my project. It would be nice to
have this fixed though.
On Jul 18, 2015 3:29 PM, "Eren Inan Canpolat" notifications@github.com
wrote:

Hi,

Any news on this? I observe similar behavior with a CSV file of mine. It
just uploads the file with .csv extension and Drive thinks it's a .doc (it
tries to open it with Google Documents).


Reply to this email directly or view it on GitHub
#232 (comment).

@canpolat
Copy link

In my use case I couldn't find a way around it. I really need it converted. So, here is some more input.

I have a CSV file named "data". Here is what happens when I push it to Google Drive:

Case 1:

drive push -quiet data

Google Drive thinks this is a plain text file. So it offers me to open the file with StackEdit, Drive Notepad, etc.

Case 2:

When I issue any of the following commands:

drive push -quiet data.csv   # Changed the filename to test it out
drive push -quiet -coerced-mime csv data

Google Drive understands that it is a CSV file and offers to open it via Drive Notepad and/or Sheets.

Case 3:

When I try the following two commands:

drive push -quiet -convert data.csv
drive push -quiet -convert -coerced-mime csv data

Both the file icon and the applications offered to open the file suggest that Google Drive has converted the file into Google Docs (not Sheets) format.

Case 4:

I converted the file to ODS locally and:

drive push -quiet -convert data.ods

This one was weird. It did not convert the file and didn't even offer to open it with Sheets (Zoho Sheet was an option, though). Apparently Google Drive doesn't support ODS.

All in all, in some cases, -convert converts, but only to Google Docs and never to Sheets.

@odeke-em, you already said that this is not a problem on drive's side (unless your investigation showed otherwise); should I report this problem somewhere else (if so, where)?

@canpolat
Copy link

Ping!

I still observe that .CSV files are converted to Google Document files instead of Sheets. @odeke-em from what you said earlier, it's clearly not a drive issue. But you are definitely closer to the Google Drive team than I am. So I wonder if there is another way of attracting their attention? Should I submit a ticket elsewhere (if so, where)? This issue really disrupts my workflow (introduces a few manual steps to an otherwise automated set up), if I sound insistent, that's the only reason :)

@odeke-em
Copy link
Owner

Oops sorry for the late reply @canpolat, my apologies I didn't mean to ignore this :)
So I think I might try out something to patch this up for you, but that will be in about 8 hours as I have an event this evening :( but surely in the next 24 hours I'll ping you.
For sure, I can consult with them and bring this issue to their attention. Thank you for the investigation, and my apologies again for the late reply plus the bug.

@odeke-em
Copy link
Owner

Hello @canpolat, so I got some time before heading out. One thing is as you'd probably noticed is that
even uploading csv files via the web UI will set the mimeType to 'text/csv'. I have started a PR to escape this in a way, please see #357.

@canpolat
Copy link

@odeke-em No worries. If this was actually a problem on drive I'm pretty sure it would have been solved by now. But dependencies are tricky :)

@odeke-em
Copy link
Owner

Hello folks, as seen in @canpolat's investigation as well as from PR #357, when csv files get converted or even uploaded, their mimeType is text/csv and this is from Google Drive itself. Now what you can do is instead of setting --convert when uploading csv and tsv files is just upload it plainly as

$ drive push csvfiles.csv

This will upload it as a spreadsheet, when you use the Google Drive Web UI viewer it will create a Google Sheet directly from it but the caveat is that create a duplicate file.

@tom-saunders
Copy link

I am coming at this from the opposite side - I don't want documents converted when they are pushed. Is there some way this can be achieved? I can open a separate issue to cover this.

(If it's relevant in my case I have plain text files which I don't want coercing into document files - I'd rather they stay as plain text. It's also very possible I'm just misunderstanding the documentation.)

@odeke-em
Copy link
Owner

Hello again @tom-saunders, --convert is an optional flag. By default no documents are converted so yours is the common case, no need for alarm :)

@tom-saunders
Copy link

It appears that uploading via the web client vs drive does something slightly different - files uploaded through drive are readable online while similar files uploaded through web client are not. This was unexpected, but doesn't appear to have caused any harm so it's no issue.

canpolat added a commit to canpolat/drive that referenced this issue Nov 20, 2015
Coercing csv, tsv to officedocument (odeke-em#357) doesn't work around odeke-em#232 ("Push flag "-convert" has no effect"). Therefore there is no need for this hack.
@canpolat
Copy link

I filed an issue at the Google Apps APIs: https://code.google.com/a/google.com/p/apps-api-issues/issues/detail?id=4198

Please star it so that it gets prioritized.

Edit: I could reproduce the issue via Google's own file upload example, so it must be an API issue.

@odeke-em
Copy link
Owner

Awesome thank you @canpolat for creating that! Am definitely going to star it too.

@odeke-em
Copy link
Owner

I've tweeted https://twitter.com/odeke_et/status/678145002174836736, please share with your friends so that we can get this starred and looked at.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants