Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

maybe_xlsx

Determine file format


Description

Whether a file may be be xlsx, xlsm, xltx or xltm (rather than xls or xlt), based on the file signature or "magic number", rather than the filename extension.

Usage

maybe_xlsx(path)

Arguments

path

File path

Details

Only 'maybe', not 'is', because the xlsx magic number is common to all zip files, not specific to xlsx files. The inverse, 'is_xls' isn't possible either, because the xls magic number is common to other Microsoft Office files such as .doc and .ppt.

This uses some logic from Jenny Bryan's commit to the readxl package.

Value

Logicial

Examples

examples_xlsx <- system.file("extdata/examples.xlsx", package = "tidyxl")
examples_xlsm <- system.file("extdata/examples.xlsm", package = "tidyxl")
examples_xltx <- system.file("extdata/examples.xltx", package = "tidyxl")
examples_xltm <- system.file("extdata/examples.xltm", package = "tidyxl")
examples_xlsb <- system.file("extdata/examples.xlsb", package = "tidyxl")
examples_xls <- system.file("extdata/examples.xls", package = "tidyxl")

maybe_xlsx(examples_xlsx)
maybe_xlsx(examples_xlsm)
maybe_xlsx(examples_xltx)
maybe_xlsx(examples_xltm)
maybe_xlsx(examples_xlsb)
maybe_xlsx(examples_xls)

tidyxl

Read Untidy Excel Files

v1.0.7
GPL-3
Authors
Duncan Garmonsway [aut, cre], Hadley Wickham [ctb] (Author of included readxl fragments), Jenny Bryan [ctb] (Author of included readxl fragments), RStudio [cph] (Copyright holder of included readxl fragments), Marcin Kalicinski [ctb, cph] (Author of included RapidXML code)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.