Builtins and Libraries
3.1 Global Utilities
3.2 Numbers
3.3 Strings
3.4 Booleans
3.5 Raw  Array
3.6 Tables
3.7 lists
3.8 sets
3.9 arrays
3.10 string-dict
3.11 option
3.12 pick
3.13 either
3.14 srcloc
3.15 pprint
3.16 s-exp
3.17 s-exp-structs
3.18 image-structs
3.19 image
3.20 world
3.21 gdrive-sheets
3.22 data-source
3.23 reactors
3.24 chart
3.25 plot
3.26 statistics
3.27 math
On this page:
3.21.1 The Spreadsheet Type
Spreadsheet
3.21.2 The Worksheet Type
Worksheet
3.21.3 Spreadsheet Functions
create-spreadsheet
my-spreadsheet
load-spreadsheet
open-sheet
open-sheet-by-index
3.21.4 Spreadsheet Methods
.sheet-names
.sheet-by-name
.sheet-by-index

3.21 gdrive-sheets

Usage:
include gdrive-sheets
import gdrive-sheets as ...

3.21.1 The Spreadsheet Type

Spreadsheets represent a connection to a Google Sheets document. These spreadsheets are primarily used to create a Table, using the load-table: syntax and the .sheet-by-name method below. However, the spreadsheet values themselves can be useful to create or modify Google Sheets documents, as well.

3.21.2 The Worksheet Type

Worksheets represent individual worksheets within a Google Sheets document. Nothing can be done directly with worksheets in Pyret, except to load them into tables.

3.21.3 Spreadsheet Functions

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.

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.

Accesses a publicly shared Google sheets file and produces a Spreadsheet. This function is more commonly used than my-spreadsheet.

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.21.4 Spreadsheet Methods

.sheet-names :: () -> List<String>

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.

.sheet-by-name :: (
name :: String,
skipHeaders :: Boolean
)
-> Worksheet

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).

.sheet-by-index :: (
index :: Number,
skipHeaders :: Boolean
)
-> Worksheet

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).