share
Stack OverflowHow to download google sheets as a CSV file without HTML?
[0] [3] dreamchaser1024
[2020-10-28 18:00:55]
[ bash shell wget ]
[ https://stackoverflow.com/questions/64578735/how-to-download-google-sheets-as-a-csv-file-without-html ]

I am trying to use bash to download google sheets as a csv file. I have it working, however its just downloading the HTML contents, not the actual cell value.

How can I use bash to download google sheets contents as a CSV File without HTML?

Below is what I have tried, and it all outputs the same. Just HTML, no cell values.

wget --no-check-certificate --output-document=import.csv 'https://docs.google.com/spreadsheets/d/1OTAyEgUTh4fNIs5SsoxuF8Nd7JqS6iPISFSHh-tS85M/edit#gid=809903748'
curl -s -d /dev/null https://docs.google.com/spreadsheets/d/1OTAyEgUTh4fNIs5SsoxuF8Nd7JqS6iPISFSHh-tS85M/edit?usp=sharing/export?exportFormat=csv > import.csv dos2unix mydocument.csv 2> /dev/null
wget --no-check-certificate -r "https://docs.google.com/spreadsheets/d/1OTAyEgUTh4fNIs5SsoxuF8Nd7JqS6iPISFSHh-tS85M/edit#gid=809903748" -O "import.csv"
wget -O ./import.csv "https://docs.google.com/spreadsheets/d/1OTAyEgUTh4fNIs5SsoxuF8Nd7JqS6iPISFSHh-tS85M/edit#gid=809903748"
Have you tried to modify the sharing configuration in the spreadsheet? See here support.google.com/docs/thread/40044224?hl=en Cheers - OOM
I have updated the sharing settings, however its still only populating the csv file with HTML - dreamchaser1024
[+1] [2020-10-28 18:58:23] Philippe

Try this :

wget --no-check-certificate --output-document=import.csv "https://docs.google.com/spreadsheets/d/1OTAyEgUTh4fNIs5SsoxuF8Nd7JqS6iPISFSHh-tS85M/export?format=csv"

This did not work, still only showing HTML for some reason. - dreamchaser1024
1
[+1] [2021-06-06 12:46:47] rainbowchsr

The command that @Philippe provided (wget --no-check-certificate --output-document=import.csv "https://docs.google.com/spreadsheets/d/<sheet_id>/export?format=csv") works. Make sure that your sheet is "Public on the web". To do so, go to Share. In the section "Get Link", click on "Change" and set "Anyone with the link" --> viewer


2
[+1] [2023-12-12 23:44:52] Moll

This command should work:

curl -L "https://docs.google.com/spreadsheets/d/1OTAyEgUTh4fNIs5SsoxuF8Nd7JqS6iPISFSHh-tS85M/export?gid=809903748&format=csv" > import.csv

The question is answered in this post [1] for more information.

[1] https://stackoverflow.com/questions/24255472/download-export-public-google-spreadsheet-as-tsv-from-command-line/28494469#28494469

great this works as expected - Bipul Jaishwal
How can I keep the URLs in hyperlinks in cells? - 5260452
3