Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dowload public Google Spreadsheet

Is there a way to quickly download a public google spreadsheet? The spreadsheet I want to download is the following:

https://docs.google.com/spreadsheets/d/e/2PACX-1vSVcmgixKaP9LC-rrqS4D2rojIz48KwKA8QBmJloX1h7f8BkUloVuiw19eR2U5WvVT4InYgnPunUo49/pubhtml

I tried various methods, for example replacing the pubhtml part of the url with export?format=csv, that didn't work.

I found one url that let's me download the first sheet: https://docs.google.com/spreadsheets/d/e/${id}/pub?output=csv&id=${id}

I want to download all sheets though, and adding a &sheet=name url-paramter didn't help. So how do I get this to work? Do I need to write code?

like image 693
Dwagner Avatar asked Oct 17 '25 13:10

Dwagner


1 Answers

In order to download all sheets, how about downloading it as the XLSX file? In order to download your URL as the XLSX file, please modify as follows. In this case, the Spreadsheet ID is not required to be used. This answer is referred.

From:

https://docs.google.com/spreadsheets/d/e/2PACX-1vSVcmgixKaP9LC-rrqS4D2rojIz48KwKA8QBmJloX1h7f8BkUloVuiw19eR2U5WvVT4InYgnPunUo49/pubhtml

To:

https://docs.google.com/spreadsheets/d/e/2PACX-1vSVcmgixKaP9LC-rrqS4D2rojIz48KwKA8QBmJloX1h7f8BkUloVuiw19eR2U5WvVT4InYgnPunUo49/pub?output=xlsx
  • When you access this URL using the browser, the XLSX file can be downloaded.

  • Also you can download it using the curl command as follows.

      curl "https://docs.google.com/spreadsheets/d/e/2PACX-1vSVcmgixKaP9LC-rrqS4D2rojIz48KwKA8QBmJloX1h7f8BkUloVuiw19eR2U5WvVT4InYgnPunUo49/pub?output=xlsx" -o sample.xlsx
    
like image 127
Tanaike Avatar answered Oct 19 '25 07:10

Tanaike