This package provides functions to read spreadsheet data from Microsoft Excel files. To achieve this, it uses functions from the package readxl.

In contrast to the default behaviour of the readxl functions, this package reads the raw text information from spreadsheets. No type conversions are performed. Being all of the same type (character) the text values are returned in a matrix and not in a data frame as it is the case for the readxl package.

Also, when using this package, all values keep their original position. By default, the readxl-functions remove empty rows at the beginning of a sheet. This leads to row numbers in the returned data frame that do not correspond to the original row numbers in the Excel sheet. For validation purposes, I prefer that all values appear at the same positions in the returned matrix as they have in the sheet. This is what this package does.

Reading Table Data from a Spreadsheet Program

MS Excel is a spreadsheet program. It does not “know” where a table starts and where it ends and it does not clearly assign a type to a column. Instead, each cell can have its own type so that there can be cells of different types in the same column. However, functions such as readxl::read_excel() try to communicate with Excel as if it was a database management system. For each column, the values in the first few rows of the column are inspected and based on the found type the whole column is then converted accordingly. This may lead to conversion errors, e.g. if the first few values look numeric but further values cannot be interpreted as numeric, such as ">1000". In these cases the readxl functions return a data frame in which the text values are removed, i.e. set to NA. This package avoids these data losses as it keeps the original (text) information and lets the user decide what to do.

Read MS spreadsheet with readxl

We demonstrate this behaviour by reading a sheet from an example Excel file. The top and bottom parts of the “table” look as follows:

table top table top

We first read this sheet with the read_excel() function from the readxl package:

As described above, the two empty rows on top were skipped. Also, column B was assumed to be numeric (double <dbl>) even though it contains a text value in row 1004 (see image above).