Importing *cell-formatting* information from excel file into R

This is a very old question but still comes up in searches so I think it is useful to point people toward the tidyxl package.

tidyxl::xlsx_cells() reads an Excel spreadsheet in as a data frame where each row represents a single cell of the spreadsheet, with its address (e.g. A1), contents, and properties.

tidyxl::xlsx_formats() returns a nested list of all the different cell formats in the Excel spreadsheet.

The local_format_id column in the data frame returned by xlsx_cells() allows you to look up the formatting information for each cell in the list returned by xlsx_formats().

More information is included in the tidyxl package vignette.

Tags:

R

Xls

Xlsx