awalker89 / openxlsx

R package for .xlsx file reading and writing.
Other
363 stars 79 forks source link

xlsx-files written by writexl::write_xlsx cannot be read by openxlsx::read.xlsx #526

Closed Close-your-eyes closed 2 years ago

Close-your-eyes commented 3 years ago

Expected Behavior

Reading an excel file with data on it into R.

Actual Behavior

A warning message appears: Warning message: No data found on worksheet.

Reason:

I believe xlsx-files that were written previously with the write_xlsx from with writexl-package cannot be read. Something in the formatting may be wrong. So, this may be actually be a problem on the writexl-package but not only ... Can this be fixed? So, that read.xlsx handles the putatively wrong formatting of xlsx files written with write_xlsx?

Solution, even though not satisfying:

Open the xlsx file with excel first and save again. Then read.xlsx can read it.

Steps to Reproduce the Problem

  1. Save data to a xlsx file with writexl::write_xlsx.

  2. Try to read it with openxlsx::read.xlsx.

  3. Get an error.

  4. Repair it by opening with excel. Alternatively though, it would be great if read.xlsx could handle it.

sessionInfo()

example-file for reproduction: example.xlsx

ycphs commented 3 years ago

Could you please create this also at ycphs/openxlsx?

I am maintaining the active fork of the package.