curl / Mailing Lists / curl-users / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Problem with published google sheet

From: Boyd Kelly via curl-users <curl-users_at_cool.haxx.se>
Date: Mon, 16 Sep 2019 08:14:55 +0000

Hi,

I have not been able to download a publicly published google sheet in tsv
with curl. (There is no authorization here) The problem seems to stem
from the gid that identifies the particular tab/sheet that is published.
Here is a sample url:

https://docs.google.com/spreadsheets/d/e/2PACX-1vSH5R8xG1ARb4Swjjl8qYbzRZdBsEcTOFGrEkToW1ln3akG3Gchzfd9r6od6EPGRldu_jcx7YMu7lCq/pub?gid=606625683&single=true&output=tsv

If I simply click on this link in a browser I am prompted with a filename
to save this as tsv and it works. With curl I just get a bunch of script
that downloads. I've tried various options (-O -J -L etc)

One thing I notice is that if there is only *ONE* sheet in the workbook
that is published and then I remove the gid=number and single=true parts of
the url I can download the file.

This is the same sheet as above but 'published' from a workbook where there
it is the only sheet:

https://docs.google.com/spreadsheets/d/e/2PACX-1vT-9DWdR54wvnrD6FLXKXKXQBOZ8pLU2PpcYt-uaPfoicwBjUVpzs7kNLIc_R9WFoTQd2cA8VxdkCP8/pub?gid=0&single=true&output=tsv

Even in this case, I need to modify the url as follows to download the file:

curl
https://docs.google.com/spreadsheets/d/e/2PACX-1vT-9DWdR54wvnrD6FLXKXKXQBOZ8pLU2PpcYt-uaPfoicwBjUVpzs7kNLIc_R9WFoTQd2cA8VxdkCP8/pub?output=tsv

However I need to download two sheets, so this is not ideal for me. Any
ideas as to why this is happening? It does appear to be some issue where
the gid selects the sheet to download. But why does it work fine in a
browser but not with curl? Is this a pure Google problem? Or is there
some curl magic that can deal with this?

Thanks for any help!

-- 
Boyd Kelly <bkelly_at_coastsystems.net>
www: http://www.coastsystems.net
Tel: +1 604 837-0765

-----------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-users
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2019-09-16