Skip to content

Read an Excel blob into an R data frame

Reads an Excel file via a storage handler created by [init_storage_handler()(init_storage_handler/) and converts the resulting Python Polars DataFrame to an R data frame. Excel import requires the Python package fastexcel. Install it with: setup_containerio_python(groups = 'excel') or reticulate::py_install("fastexcel") or pip install fastexcel. Selected columns specified via col_classes can be cast in Polars before conversion to R.

read_excel_blob_as_df(handler, blob_name, col_classes = NULL, ...)
Argument Description
handler A Python object of class StorageHandler.
blob_name The path/name of the blob/file.
col_classes A named character vector of R column classes.
... Additional arguments passed to handler$read_excel_blob().

A data frame.

handler <- init_storage_handler()
df <- read_excel_blob_as_df(
handler = handler,
blob_name = "sample/data.xlsx",
col_classes = c(
id = "character",
customer_id = "character",
amount = "numeric",
active = "logical",
created_at = "POSIXct"
)
)