[ALUG] Writing to Google Sheets from bash

Mark Rogers mark at more-solutions.co.uk
Tue Feb 21 10:10:24 GMT 2017

On 17 February 2017 at 21:26, Ewan Slater <ewan.slater at 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

More information about the main mailing list