googlesheets (version 0.3.0)

gs_new: Create a new spreadsheet

Description

Create a new spreadsheet in your Google Drive. It will contain a single worksheet which, by default, will [1] have 1000 rows and 26 columns, [2] contain no data, and [3] be titled "Sheet1". Use the ws_title, row_extent, col_extent, and ... arguments to give the worksheet a different title or extent or to populate it with some data. This function calls the Google Drive API to create the sheet and edit the worksheet name or extent. If you provide data for the sheet, then this function also calls the Google Sheets API.

Usage

gs_new(title = "my_sheet", ws_title = NULL, row_extent = NULL,
  col_extent = NULL, ..., verbose = TRUE)

Arguments

title

the title for the new spreadsheet

ws_title

the title for the new, sole worksheet; if unspecified, the Google Sheets default is "Sheet1"

row_extent

integer for new row extent; if unspecified, the Google Sheets default is 1000

col_extent

integer for new column extent; if unspecified, the Google Sheets default is 26

...

optional arguments passed along to gs_edit_cells in order to populate the new worksheet with data

verbose

logical; do you want informative messages?

Value

a googlesheet object

Details

We anticipate that if the user wants to control the extent of the new worksheet, it will be by providing input data and specifying `trim = TRUE` (see gs_edit_cells) or by specifying row_extent and col_extent directly. But not both ... although we won't stop you. In that case, note that explicit worksheet sizing occurs before data insertion. If data insertion triggers any worksheet resizing, that will override any usage of row_extent or col_extent.

See Also

gs_edit_cells for specifics on populating the new sheet with some data and gs_upload for creating a new spreadsheet by uploading a local file. Note that gs_upload is likely much faster than using gs_new and/or gs_edit_cells, so try both if speed is a concern.

Examples

Run this code
# NOT RUN {
foo <- gs_new()
foo
gs_delete(foo)

foo <- gs_new("foo", ws_title = "numero uno", 4, 15)
foo
gs_delete(foo)

foo <- gs_new("foo", ws = "I know my ABCs", input = letters, trim = TRUE)
foo
gs_delete(foo)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab