Update: a better solution
Google now presents an inbuilt library for accessing Google analytics from Google docs. You can see how to use it with a ready-made and powerful solution for template driven analytics reports and dashboards here.
This post is left here in case it is of interest to anyone. However, this is no longer the best way of accessing the Google Analytics API from Google Docs. Google have made an interface available directly within docs script, as described in the Google Analytics blog.
The Google Analytics Reporting API enables you to automate reporting tasks, combine GA data with other information, apply analysis and visualisation tools, and access data you couldn’t easily reach via the Google Analytics UI.
As well as reducing repetitive work, this reduces your chance of errors, and enables you to build up more sophisticated analysis.