Passing variables between bash and google docs
I have a similar need to this that cannot be solved by using only bash. I need to update a cell on a Google sheet from bash. I also need to fetch/wget/curl a cell from a sheet into a bash variable. Is the only way to do this with the clasp command line tool from bash? If someone could provide a command within bash that sets a bash variable to the value of a cell in a sheet that would be perfect. Thank you!
|
Quote:
Generally speaking: Google Docs is full on javascript, command line downloaders like curl or wget won't help you get at the actual document. Command line javascript engines exist, been a while for me, phantomjs comes to mind, or just your browser in headless mode. So that's just for the fetching. How to massage the doc with bash, no idea. Same answer as rtmistler's still applies I guess. Bash does not have a command line tool named clasp. Could be some 3rd party CLI utility? edit: searching my package manager for "google docs" gives a few results, one of them looks useful: gdatafs |
Welcome to LQ and the Programming forum!
Your question is complete within itself and more suitable as its own thread and has been moved accordingly. A link to the originally referenced thread has been inserted. |
As mentioned by ondoho, there's a lot more to it, so bash is prob not the lang to use.
Are you averse to using Perl? Perl has a lot(!) of interfaces into specialist tools like google spreadsheets and in fact here's a module to do what you need https://metacpan.org/pod/Net::Google::Spreadsheets |
if I understand well this is the official documentation: https://developers.google.com/sheets...te#apps-script
and you will find some examples on the bottom of that page. |
I could use the proper way to access the Google spreadsheet from bash as well.
Although @Entropy1024 suggested an alternative, the spirit of the post is to access Google sheets from bash. There is now the Sheets API : https://developers.google.com/sheets/api/guides/values and the Google Apps scripts: https://developers.google.com/sheets...rt/apps-script but nothing directly from CLI as it seemed there was with curl or wget back in the day. |
If I had to guess, authentication would be a problem from bash but I've not done this so can't speak to it exactly. Google uses oauth2 for authentication I believe. No idea if helpful but may be: https://developers.google.com/identity/protocols/oauth2
|
Quote:
Quote:
Maybe you confuse usage of the word "script", but that's not bash or Linux CLI at all. AFAICS, it's javascript but I might be wrong (extension ".gs" - probably stands for google script, lol). Quote:
|
All times are GMT -5. The time now is 06:42 PM. |