
Import a code book specification from a spreadsheet
Source:R/codebook_fromSpreadsheet.R
codebook_fromSpreadsheet.Rd
Import a code book specification from a spreadsheet
Arguments
- x
The URL or path to a file.
- localBackup
If not
NULL
, a valid filename to write a local backup to.- exportGoogleSheet
If
x
is a URL to a Google Sheet, instead of using thegooglesheets4
package to download the data, by passingexportGoogleSheet=TRUE
, an export link will be produced and the data will be downloaded as Excel spreadsheet.- xlsxPkg
Which package to use to work with Excel spreadsheets.
- silent
Whether to be silent or chatty.
Examples
### Note that this will require an active
### internet connection! This if statement
### checks for that.
# \donttest{
if (tryCatch({readLines("https://google.com",n=1); TRUE}, error=function(x) FALSE)) {
### Read the example ROCK codebook
gs_url <- paste0(
"https://docs.google.com/spreadsheets/d/",
"1gVx5uhYzqcTH6Jq7AYmsLvHSBaYaT-23c7ZhZF4jmps"
);
ROCK_codebook <- rock::codebook_fromSpreadsheet(gs_url);
### Show a bit
ROCK_codebook$metadata[1:3, ];
}
#> Error in rock::read_spreadsheet(x = x, localBackup = localBackup, exportGoogleSheet = exportGoogleSheet, xlsxPkg = xlsxPkg, silent = silent): To read Excel spreadsheets (`.xlsx`), the {readxl} package has to be installed. You can install it with:
#>
#> install.packages('readxl');
# }