| Title: | Read xlsx Files with a Native Parser |
| Version: | 0.1.0 |
| Description: | Reads tabular data from xlsx files with a specialized C parser. Worksheet XML is scanned in a single pass and decoded directly into R vectors, with no intermediate document model. Bundles the 'miniz' and 'libdeflate' decompressors to read the underlying archive. |
| License: | MIT + file LICENSE |
| Copyright: | file inst/COPYRIGHTS |
| URL: | https://github.com/vlshields/rcxl |
| BugReports: | https://github.com/vlshields/rcxl/issues |
| Encoding: | UTF-8 |
| Depends: | R (≥ 4.0) |
| Suggests: | readxl, cellranger |
| Config/roxygen2/version: | 8.1.0 |
| NeedsCompilation: | yes |
| Packaged: | 2026-09-09 23:03:10 UTC; pots |
| Author: | Vincent Shields [aut, cre, cph], Rich Geldreich [ctb, cph] (author of the bundled miniz), Tenacious Software LLC [cph] (copyright holder of the bundled miniz), RAD Game Tools and Valve Software [cph] (copyright holder of the bundled miniz), Martin Raiber [ctb, cph] (contributor to and copyright holder of the miniz ZIP reader), Alex Evans [ctb] (author of the PNG writer in the bundled miniz), Alistair Moffat [ctb] (author of the minimum-redundancy code in the bundled miniz), Jyrki Katajainen [ctb] (author of the minimum-redundancy code in the bundled miniz), Eric Biggers [ctb, cph] (author of the bundled libdeflate), Google LLC [cph] (copyright holder of the bundled libdeflate) |
| Maintainer: | Vincent Shields <vince.shields913@gmail.com> |
| Repository: | CRAN |
| Date/Publication: | 2026-09-17 14:20:02 UTC |
rcxl: Read 'xlsx' Files with a Native Parser
Description
Reads tabular data from 'xlsx' files with a specialized C parser. Worksheet XML is scanned in a single pass and decoded directly into R vectors, with no intermediate document model. Bundles the 'miniz' and 'libdeflate' decompressors to read the underlying archive.
Details
Worksheets of at least 4 MB are parsed on several threads; smaller ones are
read serially. The worker count defaults to the number of available cores,
capped at 8. Set the RCXL_THREADS environment variable to an explicit
count to override that. When _R_CHECK_LIMIT_CORES_ is set, as it is under
R CMD check, no more than two workers are used whatever the setting.
Author(s)
Maintainer: Vincent Shields vince.shields913@gmail.com [copyright holder]
Authors:
Vincent Shields vince.shields913@gmail.com [copyright holder]
Other contributors:
Rich Geldreich (author of the bundled miniz) [copyright holder]
Tenacious Software LLC (copyright holder of the bundled miniz) [copyright holder]
RAD Game Tools and Valve Software (copyright holder of the bundled miniz) [copyright holder]
Eric Biggers (author of the bundled libdeflate) [copyright holder]
Google LLC (copyright holder of the bundled libdeflate) [copyright holder]
See Also
Useful links:
Read an xlsx worksheet
Description
Reads one worksheet from an xlsx file into a data frame. Column types are
guessed from the cells unless overridden with col_types.
Usage
read_xlsx(
path,
sheet = 1L,
col_names = TRUE,
trim_ws = TRUE,
range = NULL,
skip = 0L,
n_max = Inf,
col_types = NULL,
na = "",
name_repair = c("unique", "minimal", "check_unique")
)
Arguments
path |
Path to an xlsx file. Tilde expansion is applied. |
sheet |
Worksheet to read, as a 1-based index or a sheet name.
Overridden when |
col_names |
|
trim_ws |
Trim leading and trailing whitespace from string cells and column names? |
range |
A1-style cell range to read: |
skip |
Number of rows to skip before reading anything. Ignored when
|
n_max |
Maximum number of data rows to read. The column name row
does not count. Ignored when |
col_types |
|
na |
Character vector of strings to read as |
name_repair |
How to resolve column names in the result. |
Details
A guessed column becomes character if it holds any string cell, logical if
it holds only booleans, POSIXct if it holds date cells and no plain
numbers, and numeric otherwise. Every cell in the read area informs the
guess. Columns with only blank cells become logical NA. Date cells are returned as POSIXct in UTC; both the 1900
and 1904 date systems are handled, including the nonexistent 29 Feb 1900
that the 1900 system counts.
Cells that cannot be coerced to a type forced through col_types become
NA, with a warning giving the count and the first offending cell.
Value
A data.frame with one column per worksheet column read.
See Also
read_xlsx_all() to read several sheets in one workbook pass;
xlsx_sheets() for the sheet names.
Examples
types <- system.file("extdata", "types.xlsx", package = "rcxl")
str(read_xlsx(types))
# read a rectangle rather than the whole sheet
read_xlsx(types, range = "A1:C3")
# force every column to character instead of guessing
str(read_xlsx(types, col_types = "text"))
# a sheet other than the first, by name or by position
multi <- system.file("extdata", "multisheet.xlsx", package = "rcxl")
read_xlsx(multi, sheet = "Beta")
Read several worksheets in one pass
Description
Reads multiple sheets from an xlsx file through one shared workbook pass,
so the ZIP directory, shared strings and styles are parsed once. All
arguments other than sheets apply to every sheet read.
Usage
read_xlsx_all(
path,
sheets = NULL,
col_names = TRUE,
trim_ws = TRUE,
range = NULL,
skip = 0L,
n_max = Inf,
col_types = NULL,
na = "",
name_repair = c("unique", "minimal", "check_unique")
)
Arguments
path |
Path to an xlsx file. Tilde expansion is applied. |
sheets |
Sheets to read, as a vector of 1-based indices or sheet
names. |
col_names |
|
trim_ws |
Trim leading and trailing whitespace from string cells and column names? |
range |
As in |
skip |
Number of rows to skip before reading anything. Ignored when
|
n_max |
Maximum number of data rows to read. The column name row
does not count. Ignored when |
col_types |
|
na |
Character vector of strings to read as |
name_repair |
As in |
Value
A named list of data.frames, one per sheet read, named by sheet
name.
Examples
multi <- system.file("extdata", "multisheet.xlsx", package = "rcxl")
sheets <- read_xlsx_all(multi)
names(sheets)
sheets[["Alpha"]]
# a subset of the sheets, still in one workbook pass
names(read_xlsx_all(multi, sheets = c("Alpha", "Gamma")))
List worksheet names
Description
List worksheet names
Usage
xlsx_sheets(path)
Arguments
path |
Path to an xlsx file. Tilde expansion is applied. |
Value
A character vector of sheet names in workbook order.
Examples
xlsx_sheets(system.file("extdata", "multisheet.xlsx", package = "rcxl"))