getWorksheets          package:RGoogleDocs          R Documentation

_A_c_c_e_s_s _t_h_e _c_o_n_t_e_n_t_s _o_f _a _s_p_r_e_a_d_s_h_e_e_t

_D_e_s_c_r_i_p_t_i_o_n:

     These functions provide access to the contents of a spreadsheet.
     They allow one to  access the different worksheets within a
     spreadsheet and then access the values of cells within those
     worksheets. One can convert a worksheet, or a subset of it, into a
     data frame or matrix in R.

     Having obtained a GoogleWorsheetRef, one can query its  number of
     rows and columns directly (i.e. without an additional query to the
     Google server)  and one can coerce the contents to  data frame or
     matrix  with 'as(sheetRef, "data.frame")'.

_U_s_a_g_e:

     getWorksheets(doc, con)
     sheetAsMatrix(sheet, header = FALSE, as.data.frame = TRUE, 
                    trim = TRUE, con = sheet@connection) 

_A_r_g_u_m_e_n_t_s:

     doc: the name of the spreadsheet document or a  'GoogleDocument'
          object  obtained via a call to 'getDocs'.

     con: the authenticated connection to the Google Spreadsheets API.
          This must be for the "wise" service rather than the general
          "writely" service. So this should be an object of class
          '"GoogleSpreadsheetsConnection"' created with a call of the
          form 'getGoogleDocsConnection(login, password, "wise")'.

   sheet: the sheet object of class 'GoogleWorksheetRef'.

  header: information about the column headers for the worksheet. This
          is a) a character vector giving the names of the resulting
          columns (after the empty columns have been discarded), b) a
          logical value of 'TRUE' indicating whether the first row of
          the worksheet is to be treated as the header, and c) a
          logical value of 'FALSE' indicating that there are no column
          headers available and so use V1, V2, ... 

as.data.frame: a logical value indicating whether a matrix ('FALSE') or
          a data frame ('TRUE')  is to be created

    trim: a logical value indicating whether to drop the rows and
          columns of the worksheet that have only missing values, i.e.
          those that may be used for pseudo-formatting/layout. This is
          optional as there may be rows or columns that contain
          legitmate missing values. The algorithm for converting the
          cells to a table could be more intelligent about this  and
          explicitly determine the rows and columns which have no
          values, not which contain 'NA's.

_V_a_l_u_e:

     A list of the 'GoogleWorksheetRef' objects. Each of these is an
     object of class 'GoogleWorksheetRef-class'.

     The names of the sheets are used as the names of the returned R
     list object.

_A_u_t_h_o_r(_s):

     Duncan Temple Lang

_R_e_f_e_r_e_n_c_e_s:

     <URL:
     http://code.google.com/apis/spreadsheets/docs/2.0/developers_guide_protocol.html>

_S_e_e _A_l_s_o:

     'getGoogleDocsConnection' 'getDocs'

_E_x_a_m_p_l_e_s:

     if(exists("GoogleDocsPassword")) {
           # getGoogleDocsConnection("my login", "my password", "wise")
       con = getGoogleDocsConnection(names(GoogleDocsPassword), GoogleDocsPassword, "wise")

       sheets = getWorksheets("TwoSheets", sheets.con)

       docs = getDocs(sheets.con)
       sheets = getWorksheets(docs[["TwoSheets"]], sheets.con)

       names(sheets)
     }

