Read an Excel sheet via readxl::read_excel()
with optional column-name
cleaning (janitor::clean_names()
), basic type control, and CLI messages.
Usage
read_excel_flex(
file_path,
sheet = 1,
skip = 0,
header = TRUE,
range = NULL,
col_types = NULL,
clean_names = TRUE,
guess_max = 1000,
trim_ws = TRUE,
na = "",
verbose = TRUE
)
Arguments
- file_path
Path to the Excel file (.xlsx or .xls).
- sheet
Sheet name or index to read (default: 1).
- skip
Number of lines to skip before reading data (default: 0).
- header
Logical. Whether the first row contains column names (default: TRUE).
- range
Optional cell range (e.g.,
"B2:D100"
). Default:NULL
.- col_types
Optional vector specifying column types; passed to
readxl
.- clean_names
Logical. Clean column names with
janitor::clean_names()
(default: TRUE).- guess_max
Max rows to guess column types (default: 1000).
- trim_ws
Logical. Trim surrounding whitespace in text fields (default: TRUE).
- na
Values to interpret as NA (default:
""
).- verbose
Logical. Show CLI output (default: TRUE).