This function reads all (given) sheets of one Excel file into a list of character matrices. The idea of this function is to return the content of the Excel sheets as pure raw text information. No type conversion is performed. Empty rows at the beginning are not skipped which is the default behaviour of read_xlsx that is called under the hood.

get_raw_text_from_xlsx(file, sheets = NULL, dbg = TRUE)

Arguments

file

full path to Excel file

sheets

name(s) of sheet(s) to be read, in a vector of character. If NULL, all sheets are read.

dbg

if TRUE, debug messages are shown

Examples

# Path to example file file <- system.file("extdata", "example.xlsx", package = "kwb.readxl") # Read all sheets sheet_text <- kwb.readxl::get_raw_text_from_xlsx(file)
#> #> File: 'example.xlsx' #> Folder: '/home/travis/R/Library/kwb.readxl/extdata' #> Reading sheet 'Baseline' as raw text ... #> ok. (0.02s) #> Reading sheet 'HRUA' as raw text ... #> ok. (0.01s)
# Have a look at the first rows of the first sheet head(sheet_text$sheet_01)
#> col_01 col_02 col_03 col_04 #> [1,] NA NA NA NA #> [2,] NA "WP 4: data for LCA" NA NA #> [3,] NA "Case Study:" "WWTP Moon" NA #> [4,] NA "Scenario" "Status quo (baseline)" NA #> [5,] NA NA NA NA #> [6,] "T" "Flows for water line" NA "ANNUAL MEAN VALUES" #> col_05 col_06 col_07 col_08 col_09 col_0a col_0b col_0c col_0d #> [1,] NA NA NA NA NA NA NA NA NA #> [2,] NA NA NA NA NA NA NA NA NA #> [3,] NA NA NA NA NA NA NA NA NA #> [4,] NA NA NA NA NA NA NA NA NA #> [5,] NA NA NA NA NA NA NA NA NA #> [6,] NA NA NA NA NA NA NA NA NA