简体   繁体   中英

Import worksheet list of xlsb file into R

Is there any way in R to import list or number of worksheets of xlsb excel file? I know that there is similar function for xlsx (excel_sheets) but it doesn't work for xlsb.

With the { readxlsb } package, you can make a "trick" with the debug parameter of its main function using any worksheet (label or index at sheet parameter) or named object (at range parameter) from the workbook.

library(readxlsb)

src_path <- "directory/file.xlsb"  # your filepath

df <- readxlsb::read_xlsb(
  src_path,
  sheet = 1,    # got 1st worksheet, e.g.
  debug = TRUE
)

sheets <- df$env$sheets


# number of worksheets
print(length(sheets))

# their names
print(sheets$Name)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM