3.22 gdrive-sheets
3.22.1 The Spreadsheet Type
3.22.2 The Worksheet Type
3.22.3 Spreadsheet Functions
- create-spreadsheet :: (
- name :: String
- )
- -> Spreadsheet
Creates a new Google Sheets document with the given name, in the currently logged-in user’s Google Documents account. The newly created file will not yet have any worksheets in it.
- my-spreadsheet :: (
- name :: String
- )
- -> Spreadsheet
Accesses a private Google Sheets file and produces a Spreadsheet. If the file is ever shared, change code that uses this function to instead call load-spreadsheet below.
- load-spreadsheet :: (
- id :: String
- )
- -> Spreadsheet
Accesses a publicly shared Google sheets file and produces a Spreadsheet. This function is more commonly used than my-spreadsheet.
Accepts either the ID of a Google Sheets file, or the full URL. So, for example, these two uses access the same sheet:
animal-sheet1 = load-spreadsheet("https://docs.google.com/spreadsheets/d/1VeR2_bhpLvnRUZslmCAcSRKfZWs_5RNVujtZgEl6umA/") animal-sheet2 = load-spreadsheet("1VeR2_bhpLvnRUZslmCAcSRKfZWs_5RNVujtZgEl6umA")
- open-sheet :: (
- spreadsheet :: Spreadsheet,
- name :: String,
- skipHeaders :: Boolean
- )
- -> Worksheet
Obtains the Worksheet of the given name from the given Spreadsheet. Since worksheets commonly contain a header row with names describing the contents of each column, the last parameter tells Pyret whether to ignore the first row when extracted the data from the worksheet into a table. This function is a shortcut for using load-spreadsheet followed by the .sheet-by-name method. See Loading Tables for more information.
- open-sheet-by-index :: (
- spreadsheet :: Spreadsheet,
- index :: Number,
- skipHeaders :: Boolean
- )
- -> Worksheet
Much like open-sheet, except it selects the worksheet by its index within the file, with 0 being the first worksheet in the file. This function is a shortcut for using load-spreadsheet followed by the .sheet-by-index method.
3.22.4 Spreadsheet Methods
Returns the list of worksheet names in this Spreadsheet, in order from left to right. The names in this list can be used with .sheet-by-name, and the indices of names in this list can be used with .sheet-by-index.
Obtains a Worksheet of the given name from the given worksheet. The skipHeaders argument specifies whether to ignore the first row of the sheet when extracting its contents as a table (i.e. to treat the first row as a header row rather than a data row).
Obtains a Worksheet of the given index (counting from 0) from the given worksheet. The skipHeaders argument specifies whether to ignore the first row of the sheet when extracting its contents as a table (i.e. to treat the first row as a header row rather than a data row).