
Google Docs gets an API for task automation - Manu1987
https://techcrunch.com/2019/02/11/google-docs-gets-an-api-for-task-automation/
======
legitster
They will have a lot of catchup to do to get where Office is now. I'm frankly
amazed by how good Microsoft Flow has been.

So many dumb business processes rely on an Excel doc somewhere, or a stupid
manual email somewhere else. But with Flow I've seen just a single smarty-
pants able to fully streamline an entire department one rule at a time. They
don't need to get permission to bring in a new logo - it's part of Office,
they can just do it. And no one has to get dragged into it kicking and
screaming - you want to work off of an Excel file? Fine! It's still there!

It feels like a hit of Agile steroids for an older organization.

~~~
cosmie
Hahahaha. I stumbled upon Flow last year when I switched jobs. Our
IT/procurement process is ridiculous, so I scrounged around our intranet
resources for licenses and tools that I had access to by default or could
get/request access to without triggering the Eye of Sauron to gaze down upon
me from the tower of IT Security.

My team does analytics consulting work for large multi-agency marketing
campaigns, and I used Flow and a shared mailbox to create sanity around
managing the constant flood of daily/weekly/monthly data snapshots that get
emailed and have to be synthesized and combined for end reporting/analysis.

I was also able to use Flow and PowerBI to duct tape together a "starter data
lake" architecture for our marketing clients. It's been a wild success with
clients, due in part because of it's price (in context to their expectations
for traditional "data lake pitches") but even more so due to the fact that it
gets rubber stamped through any IT review thanks to being all part of
Microsoft. It fits most clients workflows and data volumes, and seamlessly
transitions to a true data lake by pulling in Azure services as needs mature.

Most marketing departments are swimming in data but pretty lacking in their
access to technical and process/operations resources to truly manage and
leverage it. Flow has been a fantastic tool to introduce structured data
management and automation for these clients, as it's low cost enough to slide
under the radar, already implicitly allowed software as part of their Office
365 license, and gives them tangible results to show when asking for more
budget to develop/mature it further. It's far from my favorite stack to use,
but it's good enough to get the job done and breezes through all of the checks
and objections and red tape that would make virtually any other stack dead on
arrival.

~~~
jac_no_k
/me is one of the minions from team "Eye of Sauron". However I'm not stuck in
this tower.

I'm torn between two worlds. One side applauds the grass roots based solutions
and the JFDI attitude. The other side is concerned that these solutions
becomes widely used, de facto production, and problems upstream ends up
breaking the output. On error, hopefully fails loudly but subtle problems
could creep in. If the reports are consumed by other automation, the problem
spreads rapidly.

Ideally the IT department would take a step back, assess what the users (you
the stakeholder) needs are, and provide the solutions. Better Agile.

Using the successes to drive more development and operations budget is the way
to go.

~~~
lbatx
Until IT departments get infinite resources (that is, never) there will always
be a need for these JFDI solutions. Some group will always go starved for
attention and have to cobble together their own solutions. IT backlogs are
always longer than the resources to do the work.

~~~
edelans
JFDI = Just Fucking do It

(in case other ppl wonder what it means... =) )

~~~
nirav72
Or what we call 'Shadow IT' in my department.

------
jacquesm
I wished they would spend time on fixing bugs, Google docs has so many subtle
bugs it is a very annoying product to use. Of course you could argue that you
could do both new features and fix bugs but with budgets (even for Google)
finite and new features not as critical as fixing existing issues I would love
for the priority to be given to bug fixes.

Pet peeve: it is impossible to do a wysiwyg document in Google docs, it will
come out subtly different on almost every computer/browser combo and in the
end will come out different again when exported as a PDF resulting in endless
cycles of revisions.

~~~
avip
One class, or volcano, of bugs is sacredly kept only for the poor souls whos
ancestors believed writing from right to left was the greatest idea ever
(possibly after Monotheism). Try to write in multiple columns format in an RTL
lang, _then_ come back speaking of bugs. Then try a mixed RTL/LTR in a
bulletin list. One would have thought bidi would be a solved issue in 2019,
yet it consistently breaks every text editor ever made on earth.

~~~
jacquesm
That one should be #1 on that list of 'assumptions programmers make', with #2
being that a byte is 8 bits.

~~~
oblio
For all intents and purposes, a byte should be 8 bits. Standardization is
good. All those ancient systems should just die, at this point.

~~~
rkangel
Then add a dollar to every microwave, washing machine, fridge, doorbell or
other device with a hint of processing that uses a small embedded processor.
Optimising transistor gate count for simplistic application is absolutely
worth doing, even if you end up with an architecture that doesn't happen to be
the same as expected by people who have only ever programmed for x86.

~~~
oblio
That's absolutely ridiculous. Don't tell me that if we really wanted to move 7
bit or whatever other wacky architectures to 8 bits, their price would go up
by 1 dollar...

x86 is far from the only 1 byte = 8 bits architecture... PowerPC, SPARC,
Itanium, ARM, MIPS, heck, I'm having a hard time remembering major non 8 bit-
multiple architectures.

~~~
rkangel
I was exaggerating a little for effect, but not dramatically so, once you take
the multiplicative effect between BOM cost and price on the shelf.

To give you one example of a non-8 bit architecture, I used to work on CSR
Bluetooth devices. For a while, the third most popular architecture was a
little known thing called XAP, because it was in all of the 1-2 billion chips
that CSR had made. XAP is a 16 bit processor in every way you can be a 16 bit
processor: both the size of a byte (minimum addressable memory size) and the
size of a word (size used for compilation) was 16 bit. You couldn't sub-
address any larger types to serialise data. Also, the code space was separate
from data space, and so function pointers were 24 bit (2 words). This meant
that a lot of casting that developers take for granted wasn't possible (e.g.
store a pointer in an int).

All of these choices meant that the XAP was very low gate count, and so very
power and cost efficient for a surprisingly capable little processor.

------
afandian
It terrifies me how entrenched the Google suite is becoming, and more 'open'
APIs will surely further that position. It's the default for most community /
cross org collaboration and note-taking in my line of work. A huge amount of
stuff gets done in Google docs.

And then Google ban your account for some random reason and you're suddenly
barred from participating, your voice can no longer be heard, and who knows
what happens to your existing contributions. I've not seen it happen first
hand, but there are enough stories of people getting frozen out.

One alternative, which the Wikimedia community use, is Etherpad. It's ok for
text editing but less polished.

People talk on HN about moral decisions about Google / Facebooke employees.
Should that level of scrutiny apply to 3rd party plugin authors who help
consolidate market share?

~~~
skybrian
A business running GSuite getting banned would indeed be a disaster, but has
this ever happened?

For personal accounts, what happens if you create another account? It's also a
big disruption, but "your voice can no longer be heard" seems exaggerated?

~~~
afandian
In a recent HN thread [0] someone's account was literally guilty by
association with no recourse. That process is a black box. Maybe they could
blacklist an IP range. Who knows.

Let's say we're note-gathering at a conference about metadata formats for
international science collaboration. Often we get remote participants who want
to join the conversation, and selection bias says that they especially come
from developing countries and can't afford to travel. Those constituencies may
have vital information which will help to guide a standardization process for
shared metadata.

If they are blocked, for whatever reason, they may be unable to contribute to
the conversation. Maybe their missing voice means that metadata systems add
another piece of systematic bias against them and further excludes them.

I don't know of any specific examples where this has happened, but the
underpinnings are all true.

[0]
[https://news.ycombinator.com/item?id=19124324](https://news.ycombinator.com/item?id=19124324)

~~~
skybrian
The part I question is treating blocked/not blocked as a binary thing. There
are often workarounds. Some are easier than others. Some people are more
capable than others.

On the one hand we have people who need lots of hand-holding to use computers
at all, and on the other hand there are very capable hackers for whom getting
one account blocked by Google is a minor speed bump. Most of us fall somewhere
in the middle in terms of resourcefulness.

There are many other barriers to getting online, including cost, connectivity,
language, and cultural barriers. We're clearly not in a state of equal access.
I doubt remaining in Google's good graces is all that big a contribution?

~~~
afandian
Yeah, at this point pragmatism meets principle. All of the above is true, but
given a choice, why choose a platform where you even might have to 'work round
it'?

Etherpad might look more scary, but it's designed specifically to promote
inclusion and liberating data.

The thing that I find inspirational about the Wikimedia example is that they
embody principles of inclusivity in their tech choices.

------
leesalminen
One cool thing I did with the Google Drive API was pull in our app's release
notes from Google Drive. This allows our product and support teams to
write/edit release notes and have it "magically" appear in-app as HTML. The
workflow is:

1.) Employee creates a GDoc in a known, shared folder

2.) Application pulls all GDocs from this shared folder

3.) Application uses GDrive API to convert the GDoc to HTML

4.) HTML is displayed to the end user.

This proved to be an easy solution to having to involve a developer to fix a
typo in a release note.

~~~
seanwilson
Do you have to worry about abuse of the API key used to pull in the doc or
this isn't an issue (e.g. API call cost or going over a quota)?

~~~
leesalminen
We do 2 things:

1- the API keys are only used on our servers and not the device, so no new
worries about the key getting out and abused

2- we cache the results of the API calls for 5-10 minutes with Redis. So
there's no worries about the quota or rate limits.

We've been doing this for about a year with 15,000 daily active users. When we
publish a new release note roughly half read it within the first 24 hours. No
issues to report.

------
adzicg
thanks, but no thanks. I spent a month building integration with google
hangouts, only to see it being deprecated before we could even launch. wasted
months fighting with undocumented drive realtime API issues to make it work
seamlessly and it was pulled last year without replacement. drive v3 api still
does not have ETAG conditional uploads that drive v2 had. never biting that
google bait and switch thing with apis again.

~~~
frogperson
This is the reason I will not recommend Google Cloud to any of my clients. I
just can't rely on them

~~~
ghayes
Google Cloud has a very different SLA and deprecation policy than the APIs for
Google user-facing services. I have not seen a single feature deprecated or
removed without replacement in Google Cloud during my usage over the last two
years.

------
julianz
Great. Can we automate changing every single goddamn spreadsheet to not be in
US date format? And while we're in there, how about adding a locale for New
Zealand?

~~~
theDoug
I suspect you have tried this, but if not,

\- visit
[https://myaccount.google.com/language](https://myaccount.google.com/language)

\- click on (re-choose) English

\- click on New Zealand as the 'sub-language'

should set your locale across the board, rather than doing it on a per-sheet
basis. If it doesn't work, as a Canadian, I empathize with your troubles and
apologize.

~~~
julianz
Wow, that seems to have got closer, thank you. Spreadsheets are now created
with Australian locale, although they have now lost their default timezone
completely.

I'm interested whether this change will affect other Google products, in
particular whether it messes up the operation of Google Assistant on my phone
(possibly that can be overridden).

Cheers!

------
thenaturalist
Direct link:
[https://developers.google.com/docs/api/](https://developers.google.com/docs/api/)

------
xd1936
Oh cool. I've done a lot of similar projects in recent years with Apps Script
[1]. With a script that's tied to a document (or even a standalone script that
references Docs by ID), you can design your own API of sorts. Take in HTTP GET
and PUT [2], run commands with DocumentApp [3], etc.

The upside to a system like that is, the authorization flow is abstracted
completely out and handled by Google. You just pick from a dropdown as far as
who you want to have access to the Web App URL, and you don't have to deal at
all with setting up an OAuth flow.

1\. [https://developers.google.com/apps-
script/](https://developers.google.com/apps-script/)

2\. [https://developers.google.com/apps-
script/guides/web](https://developers.google.com/apps-script/guides/web)

3\. [https://developers.google.com/apps-
script/guides/docs](https://developers.google.com/apps-script/guides/docs)

~~~
bryanrasmussen
right I was thinking I can do this with apps script but I guess this abstracts
away some stuff, which is good.

------
ryeguy_24
I've been looking for a sophisticated way to automatically generate documents
for a while (formulas, data tables) with the addition of one crucial feature
that I haven't been able to find just yet: the ability to generate a document
in addition to allow human editing. For example, this is my desired workflow,
Step 1, create a document automatically, Step 2, allow humans to begin editing
with tracked changes, and Step 3, potentially update the automatically
generated content while keeping the edits. That workflow is what I'm looking
for? Any recommendations?

~~~
iak8god
Your Step 3 is the hard part.

For Steps 1 & 2 have you looked into generating markup and using Pandoc to
convert to, e.g. Word files? [https://pandoc.org/](https://pandoc.org/)

------
ClassyJacket
A logical feature, which I may even use. However -

Business-oriented releases like this need to come with a guarantee of
existence for X years (some reasonable number) if Google expects anyone to use
this for business purposes -- especially any paid/G-suite version (or whatever
their premium version is called this week). Even then, it'd be a tough sell,
as simply not shutting off the servers doesn't mean they'll actually actively
update and support it.

Google, an advertising company, is competing against Microsoft, a software
company with its roots in this exact type of software and thousand of
companies with piles of MS-specific macros and scripts and processes they've
been working with since the 90s.

Half-assing it is not going to work, even if they have a free tier available.

I use Google Drive regularly for personal documents, and even for my one-
person business, but I wouldn't dream of entrenching myself in it in such a
way that operations could be disrupted if they decide to switch the servers
off next week with two days warning.

Search isn't going away. Maps isn't going away. But everything else Google is
subject to a shut off at any second. Gmail isn't going away either, but your
specific account could, with no recourse or appeal or access to your data.

The question we should all be asking at the release of ANY new Google feature
shouldn't be "does Google have the engineering talent to make this good?". Of
course they do. If Google wanted to start making space rockets tomorrow they
could. The right question is "does Google have incentive in the form of
advertising revenue to keep working on this?"

I predict this is another feature that has already been abandoned as of this
writing, with no further updates to come.

~~~
ernsheong
Such a cynical comment. G Suite is a premium product for business and
enterprise. It isn't going anywhere.

------
nathan_f77
Oh wow, this is pretty cool. I was actually planning to build a Google Docs
plugin for my PDF templating product [1], and the UI was going to be very
similar. They seem have a pretty simple API with limited types and field
validation, so maybe there's still room for a more powerful competitor (that
also has support for e-signatures.)

But it's really interesting to see how competitors evolve over time. Now
HelloSign has been acquired by Dropbox, and Google Docs has launched their own
document generation API.

[1] [https://formapi.io](https://formapi.io)

------
jpkeisala
They talk about Content Management, why not do some development on Google
Sites finally. It seems like it's been idle for 10 years. I would like to see
some love for Google Sites so small businesses could use it make a proper
looking website where content management would be over Google Docs.

------
intrasight
I do a lot of Office automation. It's nice to know that similar can now be
done with Google Docs.

~~~
dvtrn
I found there to be a lot of demand in document automation especially in the
real estate world. What's your experience been like, just wondering?

~~~
intrasight
I've done it on and off for about 15 years. I've done some in the real estate
world as well. My experience in a nutshell:

* You have to use server-side automation - which is unsupported, and probably even violates Microsoft's terms of use.

* It's tricky. I use a serialized message queue to generate documents.

* Microsoft was dang stupid to not support automation. Such lost opportunity. I doubt that Google's supporting automation is going to change Microsoft.

------
Spectral
Hmm in this demo the interface looks exactly like Zapier (automation
service).. wonder what relationship they have:
[https://zapier.com](https://zapier.com)

~~~
halflings
The demo _is_ the Zapier interface.

From the article:

> Some of the companies that built solutions based on the new API during the
> preview period include Zapier, Netflix, Mailchimp and Final Draft.

~~~
philsnow
The demo shows manually typing static data into the fields, instead of pulling
the data dynamically from the input event like you typically would.

disclaimer, I work at Zapier

------
seanwilson
Which parts are completely new that you couldn't do before? Haven't they had
APIs for years that let you pull data out of documents and edit them as well?
Or Google Docs specifically was lacking here?

~~~
statictype
I believe its specifically Google Docs.

Google Sheets has had a reasonably good API for years.

------
doctorRetro
That's cool. Know what else would be cool and probably get more use? Fixing
bugs, improving performance on large documents, and bringing the feature set
more up to date.

~~~
irrational
But, that's all boring work. Creating new features is a lot more fun!

------
abraae
We spent a lot of time and money building a document generation add-on to our
platform. It seems that money might have been better used elsewhere!

~~~
gcatalfamo
Did you look into it already? I have yet to understand what new stuff is there
and what old stuff has just been repackaged into "office automation"

~~~
abraae
Our use case is replacing placeholders inside documents with generated values,
removing or adding entire sections, and exporting to pdf. Looks like that is
all possible.

------
arsalanb
This is interesting and kind of weird at the same time. I think Google has
missed the point completely with this. While it is true that the future of
documents is API driven and task automation will meet document editors, this
is simply not the way forward.

It's like Henry Ford giving people who are looking for faster and more
economical transportation an assembly line instead of a car. Here is why:

\- Task automation, by definition is supposed to save time and money. By
building a developer API, you still need developers (whose time costs more
money!) to build and maintain your automations.

\- The underlying document model itself cannot be accessed. So what they've
made is some kind of HandleBarJS way of creating documents and filling them
in.

I'm working on something in a similar space
([https://afterclass.co](https://afterclass.co)) and we've had to build our
own document model and automation handler to work around these two problems.
Would be interesting to see how this pans out :)

------
tptacek
I was pretty psyched about this, but it looks like you can't control table
styles with it? Styled tables are a pretty big part of how you end up
controlling formatting in GDocs, so I don't think I can build this into our
workflow without that.

~~~
DoubleCribble
It definitely exists within the Apps Script functionality. [0]

[0] [https://developers.google.com/apps-
script/reference/document...](https://developers.google.com/apps-
script/reference/document/table#setAttributes\(Object\))

------
zapov
I’m glad to see that binding data with document templates is slowly becoming
used more often. I always saw it as a killer feature, and actually built one
of my products around that idea way in 2011 [1].

Once you leave the simple use cases of just replacing tags it gets quite
complicated, but you can build really complex documents that way [2].

    
    
      [1] http://templater.info
      [2] https://github.com/ngs-doo/templaterexamples

------
fjabre
Google is ridiculous with its API restrictions and lackluster offerings. For a
software company it astounds me how poor and mismanaged their API options are.
Unreliable in the sense they pull the plug a lot with these pet projects
leaving devs hanging. Can they be trusted?

------
Scarbutt
Genuine question, What's the use case for this? If you already have to do some
programming how is it different from generating html documents (like invoices)
(that can be converted to PDF) and some web forms for filling out the
templates?

~~~
abraae
One use case is generating contracts. The end users can maintain and author
the contract templates because they are in a familiar environment. Then use
the API to plug data into the placeholders to create the finished doc.

------
grakic
I wish for a similar API for Google Data Studio documents.

------
hawkjo
Does this mean managed bibliographies will finally become a reality in google
docs? That’s the only thing keeping me from using it much.

------
EGreg
Now if only I could automate my mail merge and build a CRM from a spreadsheet,
scan business cards into it and hit a button.

------
JulianMorrison
This is me not trusting yet another open api that will close the minute it
gets inconvenient.

------
londons_explore
It seems all of this was possible before the new API.

Google Docs already had an HTML import/export API, which allowed you to
download a document, make changes, and save those changes back again. That
would allow you to implement any kind of templating you like. This API just
makes it slightly easier and more visible.

~~~
gboudrias
> This API just makes it slightly easier and more visible.

Yeah that's what APIs do. You can usually work with CURL requests/scraping
too, but it always feels clunky and improvised, much like the method you are
describing seems to me.

Making something easier means making it more accessible, means the tech based
around these tools will advance faster, and that's good for everyone. It's not
just a new bauble, well, except it's Google, but it will be very useful until
they inevitably abandon it.

------
kumarski
I've been using mintdata.com and afterclass.co as the alternative.

Googledocs gets annoying.

------
el3ctron
so cool except when you think about your info is handled by a company who
collaborates with NSA. Good bye google.

------
jethro_tell
now they can automate shutting it down in 4 years after they do a half ass job
of adding features.

------
kumarski
I use mintdata.com and afterclass.co

------
cco
They could have chosen any amount for a salary in the example and they chose
$25,000?

~~~
jessaustin
There's no reason to make people feel bad.

~~~
cco
That is a salary below the minimum wage in many major American cities and only
200% of the federal poverty line. I'm not suggesting six figures, but maybe
40,000? It just seems odd to me to use a figure that low in a example.

------
efangs
This will be nice until they take it away...

~~~
riku_iki
Or change API and you need to rewrite all your code..

~~~
chillacy
Google is pretty good about API versioning I've found. Likely they will
release a V2 and deprecate V1 at some point.

------
fernly
Excellent, a brand new attack surface for malware. Cue the report of a Docs
worm in: three, two...

------
tylfin
Do Google Doc features really impact the community enough warrant a post?

Just seems like marketing to me.

~~~
stronglikedan
The cool thing about HN is that, by its very nature, any post that gets voted
to the front page is warranted.

~~~
tylfin
On the flip-side, it's easier for a large organization like Google to
manipulate the post that gets voted to the front page.

~~~
oom
Google Docs has approximately 1 billion daily active users.

Hacker News has fewer than 1 million monthly active users.

Google is a deeply polarizing HN topic, where many of any article's comments
reduce to snark about longevity of Google products, or proclamations that
anyone using Google services is a fool who doesn't understand privacy.

Please tell us more about your theory of Google's astroturf marketing campaign
on Hacker News.

[https://techcrunch.com/2017/03/09/google-drive-now-
has-800m-...](https://techcrunch.com/2017/03/09/google-drive-now-
has-800m-users-and-gets-a-big-update-for-the-enterprise/)

[https://news.ycombinator.com/item?id=9220098](https://news.ycombinator.com/item?id=9220098)

------
asah
FYI the Python quickstart.py is broken on Ubuntu 18.04 (tried both python2 and
python3). I've notified the eng in the video, and sent her here.

By definition, credentials.json doesn't exist yet and this throws an error.
Transcript below.

    
    
        creds = None
        if os.path.exists('token.pickle'):
            ...
        # If there are no (valid) credentials available, let the user log in.
        if not creds or not creds.valid:
            if creds and creds.expired and creds.refresh_token:
                ...
            else:
                flow = InstalledAppFlow.from_client_secrets_file(
                    'credentials.json', SCOPES)
                creds = flow.run_local_server()
    
    

[https://developers.google.com/docs/api/quickstart/python](https://developers.google.com/docs/api/quickstart/python)

$ sudo apt install python3-pip Reading package lists... Done Building
dependency tree Reading state information... Done The following packages were
automatically installed and are no longer required: grub-pc-bin libpython-all-
dev libpython-dev libpython2.7 libpython2.7-dev python-all python-all-dev
python-asn1crypto python-cffi-backend python-crcmod python-crypto python-
cryptography python-dbus python-dev python-enum34 python-gi python-idna
python-ipaddress python-keyring python-keyrings.alt python-secretstorage
python-six python-wheel python-xdg python2.7-dev Use 'sudo apt autoremove' to
remove them. The following NEW packages will be installed: python3-pip 0
upgraded, 1 newly installed, 0 to remove and 11 not upgraded. Need to get 114
kB of archives. After this operation, 599 kB of additional disk space will be
used. Get:1 [http://us-
east4-c.gce.clouds.archive.ubuntu.com/ubuntu](http://us-
east4-c.gce.clouds.archive.ubuntu.com/ubuntu) bionic-updates/universe amd64
python3-pip all 9.0.1-2.3~ubuntu1 [114 kB] Fetched 114 kB in 1s (175 kB/s)
Selecting previously unselected package python3-pip. (Reading database ...
128010 files and directories currently installed.) Preparing to unpack
.../python3-pip_9.0.1-2.3~ubuntu1_all.deb ... Unpacking python3-pip
(9.0.1-2.3~ubuntu1) ... Setting up python3-pip (9.0.1-2.3~ubuntu1) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...

$ pip3 install --upgrade google-api-python-client google-auth-httplib2 google-
auth-oauthlib Collecting google-api-python-client Downloading
[https://files.pythonhosted.org/packages/55/e9/e8fb2e3a031cb6...](https://files.pythonhosted.org/packages/55/e9/e8fb2e3a031cb69b9524b80a92b126665d9a17421700a219555e3233ab6a/google_api_python_client-1.7.8-py3-none-
any.whl) (56kB) 100% || 61kB 3.1MB/s Collecting google-auth-httplib2 Using
cached
[https://files.pythonhosted.org/packages/33/49/c814d6d438b823...](https://files.pythonhosted.org/packages/33/49/c814d6d438b823441552198f096fcd0377fd6c88714dbed34f1d3c8c4389/google_auth_httplib2-0.0.3-py2.py3-none-
any.whl) Collecting google-auth-oauthlib Using cached
[https://files.pythonhosted.org/packages/46/df/d1f94ee2cffe5a...](https://files.pythonhosted.org/packages/46/df/d1f94ee2cffe5a83721f262efe51f3b2dcdd3b616caf007b8490e824c550/google_auth_oauthlib-0.2.0-py2.py3-none-
any.whl) Collecting six<2dev,>=1.6.1 (from google-api-python-client) Using
cached
[https://files.pythonhosted.org/packages/73/fb/00a976f728d0d1...](https://files.pythonhosted.org/packages/73/fb/00a976f728d0d1fecfe898238ce23f502a721c0ac0ecfedb80e0d88c64e9/six-1.12.0-py2.py3-none-
any.whl) Collecting httplib2<1dev,>=0.9.2 (from google-api-python-client)
Using cached
[https://files.pythonhosted.org/packages/ce/ed/803905d670b52f...](https://files.pythonhosted.org/packages/ce/ed/803905d670b52fa0edfdd135337e545b4496c2ab3a222f1449b7256eb99f/httplib2-0.12.0.tar.gz)
Collecting uritemplate<4dev,>=3.0.0 (from google-api-python-client)
Downloading
[https://files.pythonhosted.org/packages/e5/7d/9d5a640c4f8bf2...](https://files.pythonhosted.org/packages/e5/7d/9d5a640c4f8bf2c8b1afc015e9a9d8de32e13c9016dcc4b0ec03481fb396/uritemplate-3.0.0-py2.py3-none-
any.whl) Collecting google-auth>=1.4.1 (from google-api-python-client) Using
cached
[https://files.pythonhosted.org/packages/4e/85/71b2dfbf5b4241...](https://files.pythonhosted.org/packages/4e/85/71b2dfbf5b4241cd031cc333ed71f90a271074a97cb2c517bb65f07a1a90/google_auth-1.6.2-py2.py3-none-
any.whl) Collecting requests-oauthlib>=0.7.0 (from google-auth-oauthlib) Using
cached
[https://files.pythonhosted.org/packages/c2/e2/9fd03d55ffb70f...](https://files.pythonhosted.org/packages/c2/e2/9fd03d55ffb70fe51f587f20bcf407a6927eb121de86928b34d162f0b1ac/requests_oauthlib-1.2.0-py2.py3-none-
any.whl) Collecting cachetools>=2.0.0 (from google-auth>=1.4.1->google-api-
python-client) Using cached
[https://files.pythonhosted.org/packages/39/2b/d87fc2369242bd...](https://files.pythonhosted.org/packages/39/2b/d87fc2369242bd743883232c463f28205902b8579cb68dcf5b11eee1652f/cachetools-3.1.0-py2.py3-none-
any.whl) Collecting pyasn1-modules>=0.2.1 (from google-auth>=1.4.1->google-
api-python-client) Using cached
[https://files.pythonhosted.org/packages/da/98/8ddd9fa4d84065...](https://files.pythonhosted.org/packages/da/98/8ddd9fa4d84065926832bcf2255a2b69f1d03330aa4d1c49cc7317ac888e/pyasn1_modules-0.2.4-py2.py3-none-
any.whl) Collecting rsa>=3.1.4 (from google-auth>=1.4.1->google-api-python-
client) Using cached
[https://files.pythonhosted.org/packages/02/e5/38518af393f7c2...](https://files.pythonhosted.org/packages/02/e5/38518af393f7c214357079ce67a317307936896e961e35450b70fad2a9cf/rsa-4.0-py2.py3-none-
any.whl) Collecting oauthlib>=3.0.0 (from requests-oauthlib>=0.7.0->google-
auth-oauthlib) Using cached
[https://files.pythonhosted.org/packages/16/95/699466b05b72b9...](https://files.pythonhosted.org/packages/16/95/699466b05b72b94a41f662dc9edf87fda4289e3602ecd42d27fcaddf7b56/oauthlib-3.0.1-py2.py3-none-
any.whl) Collecting requests>=2.0.0 (from requests-oauthlib>=0.7.0->google-
auth-oauthlib) Using cached
[https://files.pythonhosted.org/packages/7d/e3/20f3d364d6c8e5...](https://files.pythonhosted.org/packages/7d/e3/20f3d364d6c8e5d2353c72a67778eb189176f08e873c9900e10c0287b84b/requests-2.21.0-py2.py3-none-
any.whl) Collecting pyasn1<0.5.0,>=0.4.1 (from pyasn1-modules>=0.2.1->google-
auth>=1.4.1->google-api-python-client) Using cached
[https://files.pythonhosted.org/packages/7b/7c/c9386b82a25115...](https://files.pythonhosted.org/packages/7b/7c/c9386b82a25115cccf1903441bba3cbadcfae7b678a20167347fa8ded34c/pyasn1-0.4.5-py2.py3-none-
any.whl) Collecting urllib3<1.25,>=1.21.1 (from requests>=2.0.0->requests-
oauthlib>=0.7.0->google-auth-oauthlib) Using cached
[https://files.pythonhosted.org/packages/62/00/ee1d7de624db8b...](https://files.pythonhosted.org/packages/62/00/ee1d7de624db8ba7090d1226aebefab96a2c71cd5cfa7629d6ad3f61b79e/urllib3-1.24.1-py2.py3-none-
any.whl) Collecting certifi>=2017.4.17 (from requests>=2.0.0->requests-
oauthlib>=0.7.0->google-auth-oauthlib) Using cached
[https://files.pythonhosted.org/packages/9f/e0/accfc1b56b57e9...](https://files.pythonhosted.org/packages/9f/e0/accfc1b56b57e9750eba272e24c4dddeac86852c2bebd1236674d7887e8a/certifi-2018.11.29-py2.py3-none-
any.whl) Collecting chardet<3.1.0,>=3.0.2 (from requests>=2.0.0->requests-
oauthlib>=0.7.0->google-auth-oauthlib) Using cached
[https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e42...](https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-
any.whl) Collecting idna<2.9,>=2.5 (from requests>=2.0.0->requests-
oauthlib>=0.7.0->google-auth-oauthlib) Using cached
[https://files.pythonhosted.org/packages/14/2c/cd551d81dbe152...](https://files.pythonhosted.org/packages/14/2c/cd551d81dbe15200be1cf41cd03869a46fe7226e7450af7a6545bfc474c9/idna-2.8-py2.py3-none-
any.whl) Building wheels for collected packages: httplib2 Running setup.py
bdist_wheel for httplib2 ... done Stored in directory:
/home/asah/.cache/pip/wheels/6d/41/4b/2b369d6e2b7eaebcdd423516d3fb659c7658c16a2be8fd04ec
Successfully built httplib2 Installing collected packages: six, httplib2,
cachetools, pyasn1, pyasn1-modules, rsa, google-auth, google-auth-httplib2,
uritemplate, google-api-python-client, oauthlib, urllib3, certifi, chardet,
idna, requests, requests-oauthlib, google-auth-oauthlib Successfully installed
cachetools-3.1.0 certifi-2018.11.29 chardet-3.0.4 google-api-python-
client-1.7.8 google-auth-1.6.2 google-auth-httplib2-0.0.3 google-auth-
oauthlib-0.2.0 httplib2-0.12.0 idna-2.8 oauthlib-3.0.1 pyasn1-0.4.5
pyasn1-modules-0.2.4 requests-2.21.0 requests-oauthlib-1.2.0 rsa-4.0
six-1.12.0 uritemplate-3.0.0 urllib3-1.24.1

$ python quickstart.py InstalledAppFlow.from_client_secrets_file()...
Traceback (most recent call last): File "quickstart.py", line 47, in <module>
main() File "quickstart.py", line 32, in main 'credentials.json', SCOPES) File
"/home/asah/.local/lib/python2.7/site-packages/google_auth_oauthlib/flow.py",
line 171, in from_client_secrets_file with open(client_secrets_file, 'r') as
json_file: IOError: [Errno 2] No such file or directory: 'credentials.json'

$ cat quickstart.py from __future__ import print_function import pickle import
os.path from googleapiclient.discovery import build from
google_auth_oauthlib.flow import InstalledAppFlow from
google.auth.transport.requests import Request

# If modifying these scopes, delete the file token.pickle. SCOPES =
['[https://www.googleapis.com/auth/documents.readonly'](https://www.googleapis.com/auth/documents.readonly')]

# The ID of a sample document. DOCUMENT_ID = '195j9eDD3ccgjQRttHhJPymLJUCOUjs-
jmwTrekvdjFE'

def main(): """Shows basic usage of the Docs API. Prints the title of a sample
document. """ creds = None # The file token.pickle stores the user's access
and refresh tokens, and is # created automatically when the authorization flow
completes for the first # time. if os.path.exists('token.pickle'): with
open('token.pickle', 'rb') as token: creds = pickle.load(token) # If there are
no (valid) credentials available, let the user log in. if not creds or not
creds.valid: if creds and creds.expired and creds.refresh_token:
creds.refresh(Request()) else:
print("InstalledAppFlow.from_client_secrets_file()...") flow =
InstalledAppFlow.from_client_secrets_file( 'credentials.json', SCOPES) creds =
flow.run_local_server() # Save the credentials for the next run with
open('token.pickle', 'wb') as token: pickle.dump(creds, token)

    
    
        service = build('docs', 'v1', credentials=creds)
    
        # Retrieve the documents contents from the Docs service.
        document = service.documents().get(documentId=DOCUMENT_ID).execute()
    
        print('The title of the document is: {}'.format(document.get('title')))
    
    

if __name__ == '__main__': main()

~~~
sjcoles
You are missing a credentials.json file. This is not the code's fault but your
own.

Read the document you linked:
[https://developers.google.com/docs/api/quickstart/python](https://developers.google.com/docs/api/quickstart/python)

Read directly above and below the giant blue "ENABLE THE GOOGLE DOCS API"
button.

~~~
asah
thanks - I was expecting the code itself to do the credentials dance.

