googlesheets4 0.2.0

googlesheets4 can now write and modify Sheets.

Several new articles are available at

Function naming scheme

The universal sheets_ prefix has been replaced by a scheme that conveys more information about the scope of the function. There are three prefixes:

The addition of write/edit functionality resulted in many new functions and the original naming scheme proved to be problematic. The article Function and class names contains more detail.

Any function present in the previous CRAN release, v0.1.1, still works, but triggers a warning with strong encouragement to switch to the current name.

Write Sheets

googlesheets4 now has very broad capabilities around Sheet creation and modification. These functions are ready for general use but are still marked experimental, as they may see some refinement based on user feedback.

(Work)sheet operations

The sheet_*() family of functions operate on the (work)sheets inside an existing (spread)Sheet:

Range operations

range_speedread() reads from a Sheet using its “export=csv” URL and, therefore, uses readr-style column type specification. It still supports fairly general range syntax and auth. For very large Sheets, this can be substantially faster than read_sheet().

range_read_cells() (formerly known as sheets_cells()) gains two new arguments that make it possible to get more data on more cells. By default, we get only the fields needed to parse cells that contain values. But range_read_cells(cell_data = "full", discard_empty = FALSE) is now available if you want full cell data, including formatting, even for cells that have no value (#4).

range_autofit() adjusts column width or row height to fit the data. This only affects the display of a sheet and does not change values or dimensions.

Printing a Sheet ID

The print method for sheets_id objects now attempts to reveal the current Sheet metadata available via gs4_get(), i.e. it makes an API call (but it should never error).

Other changes and additions

gs_formula() implements a vctrs S3 class for storing Sheets formulas.

gs4_fodder() is a convenience function that creates a filler data frame you can use to make toy sheets you’re using to practice on or for a reprex.

Renamed classes

The S3 class sheets_Spreadsheet is renamed to googlesheets4_spreadsheet, a consequence of rationalizing all internal and external classes (detailed in the article Function and class names). googlesheets4_spreadsheet is the class that holds metadata for a Sheet and it is connected to the API’s Spreadsheet schema. The return value of gs4_get() has this class.

Bug fixes

googlesheets4 0.1.1

googlesheets4 0.1.0