Skip to content
Prev 201949 / 398503 Next

Reading from Google Docs

Farrel Buchinsky wrote:
You are using a connection to the wise service (for worksheets)
to get the list of documents from the document service.

If you call getDocs() with an connection to writely, I
imagine it will succeed.

So you have a token, but it is for the wrong thing.
The first thing is to learn about debugging in R.
For example,

options(error = recover)

getDocs(sheets.con)

The error occurs and you are presented with a menu prompt that allows you
to select the call frame of interest. There is only one - getDocs().
Enter 1 <Return>.  Now you have an R prompt  that allows you to explore
the call frame.

 objects()

 body()


Take a look at status

  status


                    WWW-Authenticate
"GoogleLogin realm=\"http://www.google.com/accounts/ClientLogin\", service=\"writely\""
                                                                           Content-Type
                                                             "text/html; charset=UTF-8"
                                                                                   Date
                                                        "Sat, 28 Nov 2009 17:36:16 GMT"
                                                                                Expires
                                                        "Sat, 28 Nov 2009 17:36:16 GMT"
                                                                          Cache-Control
                                                                   "private, max-age=0"
                                                                 X-Content-Type-Options
                                                                              "nosniff"
                                                                       X-XSS-Protection
                                                                                    "0"
                                                                        X-Frame-Options
                                                                           "SAMEORIGIN"
                                                                                 Server
                                                                              "GFE/2.0"
                                                                      Transfer-Encoding
                                                                              "chunked"
                                                                                 status
                                                                                  "401"
                                                                          statusMessage
                                                                        "Token invalid"


This is the parsed header of the reply from the GoogleDocs server.

x contains the result of the query and it is an HTML document with the (same) error message.