ycphs / openxlsx

openxlsx - a fast way to read and write complex xslx files
https://ycphs.github.io/openxlsx/
Other
226 stars 75 forks source link

loadworkbook function returns error "Error in loadWorkbook(Pla_dolar, isUnzipped = TRUE) : object 'sheetrId' not found" #459

Open GustavoEAvila opened 11 months ago

GustavoEAvila commented 11 months ago

loadworkbook function returns error "Error in loadWorkbook(Pla_dolar, isUnzipped = TRUE) : object 'sheetrId' not found". I have tried with different files and different locations in my files to rule out any issue with the specific file or length of the location name.

This is the image of the error if it helps in any way.... image

Im running R version 4.3.2 "Eye Holes" on RStudio 2023.09.1+494 "Desert Sunflower" Release (cd7011dce393115d3a7c3db799dda4b1c7e88711, 2023-10-16) for windows

openxlsx package version 4.2.5.2

Catherine-Celice commented 9 months ago

I am sorry that I don't know how to fix this openxlsx code, but I do know how to work around it in my code.

My Excel files are NEVER zipped, but when using loadWorkbook(), I use the default argument "isUnzipped = FALSE".

For some reason this works. I have never tried to load a zipped file.

Both of these work even though the file IS unzipped: wb <- loadWorkbook(summaryInputFilePath) wb <- loadWorkbook(summaryInputFilePath, isUnzipped = FALSE)

StevenHibble-Concurrence commented 6 months ago

It is unlikely that you want isUnzipped = TRUE. xlsx files are really just zip files in disguise. If you change the file extension to ".zip", you can extract the files to see the underlying structure. isUnzipped = TRUE is meant to be used when you have an unzipped directory of your xlsx file's internal contents.

With isUnzipped = FALSE (the default), loadWorkbook() unzips your xlsx and extracts the contents for you.