Data Science Desktop Survival Guide
by Graham Williams
Excel Data Read
20200104 Microsoft Excel spreadsheets are supported by readxl which provides readxl::read_excel(). A common requirement is to skip= the first few lines of the spreadsheet which might be taken up with logos and file meta data. A specific sheet can be chosen with sheet=2 to select the second sheet or sheet="expenses" to select a named sheet. A specific range within a sheet is selected using range=. The package also provides readxl::excel_format() and readxl::excel_sheets().
Below we read data from the Sydney tab of the weatherAUS.xlsx spreadsheet created in Section 6.5.
library(magrittr) # Data pipelines: %>% %<>% %T>% equals().
library(glue) # Format strings: glue().
library(readxl) # Read Excel spreadsheets: read_excel().
dsname <- "weatherAUS"
dstype <- "xlsx"
fsep <- .Platform$file.sep
dspath %>% excel_format()
dspath %>% excel_sheets()
dspath %>% read_excel(sheet="Sydney")