I don't suppose anyone here has any experience of writing to Google Sheets from bash? (Specifically, I'm trying to use curl to write values into a pre-existing spreadsheet.)
I started with a fairly simple aim: To have a few Linux boxes (servers, Pi's, etc) periodically update a central spreadsheet with stuff like disk utilisation, updates pending, O/S version, etc.
However I haven't had to deal with OAuth2 before and I'm going round in circles trying to find out exactly what authentication I need to configure. My attempts at Googling have lead me into most of those circles without getting me out again!
It seems like a useful concept to pursue but I have to admit I'm just way out of my depth!
Hi Mark,
Calling a REST API from Bash using curl is an exercise in masochism.
I strongly recommend writing your scripts in Python using the requests package. If you prefer Ruby I recommend the httpclient gem.
Cheers,
Ewan
On 17 February 2017 at 15:36, Mark Rogers mark@more-solutions.co.uk wrote:
I don't suppose anyone here has any experience of writing to Google Sheets from bash? (Specifically, I'm trying to use curl to write values into a pre-existing spreadsheet.)
I started with a fairly simple aim: To have a few Linux boxes (servers, Pi's, etc) periodically update a central spreadsheet with stuff like disk utilisation, updates pending, O/S version, etc.
However I haven't had to deal with OAuth2 before and I'm going round in circles trying to find out exactly what authentication I need to configure. My attempts at Googling have lead me into most of those circles without getting me out again!
It seems like a useful concept to pursue but I have to admit I'm just way out of my depth!
-- Mark Rogers // More Solutions Ltd (Peterborough Office) // 0844 251 1450 Registered in England (0456 0902) 21 Drakes Mews, Milton Keynes, MK8 0ER
main@lists.alug.org.uk http://www.alug.org.uk/ https://lists.alug.org.uk/mailman/listinfo/main Unsubscribe? See message headers or the web site above!
On 17 February 2017 at 21:26, Ewan Slater ewan.slater@gmail.com wrote:
Calling a REST API from Bash using curl is an exercise in masochism.
Maybe that's why it appeals :-)
I strongly recommend writing your scripts in Python using the requests package.
I've found various samples using whole Google Docs libraries to make life easier, but I'd settle for some sample Python that just uses basic libraries to handle the HTTP(S) side of things. From that I could probably work it out in Bash too.
However, where I'm stuck isn't (I don't think) so much at the "Calling a REST API from Bash using curl" stage, but in working out what combination of API keys and security credentials I need to set up first to make anything have a chance of working. I've read enough on the subject that it would have killed a couple of forests if I'd printed it first, but I'm still clueless.
What I've failed to find are any straightforward examples that aren't basically trivial because their first step is to include a library that hides all the complexity away. Not that I necessarily have anything against that, but I don't really want to have to install loads of dependencies on each VM/Pi/etc that I want to monitor when in principle all it should need is curl (or maybe Python with a couple of libraries that are probably already installed anyway). And if I do install all those dependencies and test the sample code I'm pretty sure I'm then still going to have to work out the same authentication/API key issues I'm stuck at now!
If you prefer Ruby I recommend the httpclient gem.
Masochist I may be, but I draw the line at Ruby....
@Mark, if you're still interested in this topic you might want to look at https://dev.to/philnash/google-spreadsheets-and-ruby
On 21 February 2017 at 10:10, Mark Rogers mark@more-solutions.co.uk wrote:
On 17 February 2017 at 21:26, Ewan Slater ewan.slater@gmail.com wrote:
Calling a REST API from Bash using curl is an exercise in masochism.
Maybe that's why it appeals :-)
I strongly recommend writing your scripts in Python using the requests package.
I've found various samples using whole Google Docs libraries to make life easier, but I'd settle for some sample Python that just uses basic libraries to handle the HTTP(S) side of things. From that I could probably work it out in Bash too.
However, where I'm stuck isn't (I don't think) so much at the "Calling a REST API from Bash using curl" stage, but in working out what combination of API keys and security credentials I need to set up first to make anything have a chance of working. I've read enough on the subject that it would have killed a couple of forests if I'd printed it first, but I'm still clueless.
What I've failed to find are any straightforward examples that aren't basically trivial because their first step is to include a library that hides all the complexity away. Not that I necessarily have anything against that, but I don't really want to have to install loads of dependencies on each VM/Pi/etc that I want to monitor when in principle all it should need is curl (or maybe Python with a couple of libraries that are probably already installed anyway). And if I do install all those dependencies and test the sample code I'm pretty sure I'm then still going to have to work out the same authentication/API key issues I'm stuck at now!
If you prefer Ruby I recommend the httpclient gem.
Masochist I may be, but I draw the line at Ruby....
-- Mark Rogers // More Solutions Ltd (Peterborough Office) // 0844 251 1450 Registered in England (0456 0902) 21 Drakes Mews, Milton Keynes, MK8 0ER
main@lists.alug.org.uk http://www.alug.org.uk/ https://lists.alug.org.uk/mailman/listinfo/main Unsubscribe? See message headers or the web site above!
On 15 March 2017 at 16:59, Ewan Slater ewan.slater@gmail.com wrote:
@Mark, if you're still interested in this topic you might want to look at https://dev.to/philnash/google-spreadsheets-and-ruby
Thanks for this. Particularly in the Google API setup stuff at the top there looks to be useful (non language specific) info here.
On 16 March 2017 at 09:07, Mark Rogers mark@more-solutions.co.uk wrote:
On 15 March 2017 at 16:59, Ewan Slater ewan.slater@gmail.com wrote:
@Mark, if you're still interested in this topic you might want to look at https://dev.to/philnash/google-spreadsheets-and-ruby
Thanks for this. Particularly in the Google API setup stuff at the top there looks to be useful (non language specific) info here.
Not strictly related as this is Gmail but I think there's a fair bit of overlap, but I found some actually useful step-by step instructions here that allowed me to get some PHP code reading from a Gmail account if anyone else is interested...
http://kwynn.com/t/7/03/php_imap_oauth2.html