- Open Spreadsheet you want to allow access to
- Go to
Tools -> Script Editor
- Enable google sheets api:
- Open in the menu
Resources / Advanced Google Services ...
- Find
Google Sheets
in the list and enable it - Finish the dialog
- Open in the menu
- In
Script Editor
make sureView -> Show manifest file
is checked - Make sure
appscript.json
file looks like our./appscript.json
- Make sure
Code.gs
file looks like our./code.gs
- Publish script by opening
Publish -> Deploy as web app
- Set
Project version
toNew
- Set
Execute the app as
toMe
- Set
Who has access to the app
toAnyone, even anonymous
- Hit
Update
- (On first try) You have to
Review permissions
andAllow
permissions. Follow on screen instructions.
- Set
- You will get an URL - like:
https://script.google.com/macros/s/xxxxx-yyyyy/exec
- Use this with query param
?sheet=header
, whereheader
is Sheet Tab name (do not use spaces in Tab names)
Example:
https://script.google.com/macros/s/xxxxx-yyyyy/exec?sheet=Sheet1
-- many thanx to @gabor
And for those that need a
curl
example:URL looks like this:
https://docs.google.com/spreadsheets/d/${my_key}/export?format=csv&usp=sharing
Working Example:
https://docs.google.com/spreadsheets/d/1KdNsc63pk0QRerWDPcIL9cMnGQlG-9Ue9Jlf0PAAA34/export?format=csv&usp=sharing
curl looks like this:
curl -fsSL "https://docs.google.com/spreadsheets/d/${my_key}/export?format=csv&usp=sharing"
Working Example:
curl -fsSL "https://docs.google.com/spreadsheets/d/1KdNsc63pk0QRerWDPcIL9cMnGQlG-9Ue9Jlf0PAAA34/export?format=csv&usp=sharing"
Key is taken from the "Anyone with a link can access" link (like https://docs.google.com/spreadsheets/d/1KdNsc63pk0QRerWDPcIL9cMnGQlG-9Ue9Jlf0PAAA34/edit?usp=sharing)
Re: https://gist.github.com/dhlavaty/6121814#gistcomment-3930810