0
votes

I have created an Excel file using the xlsx package in R. When I go to open the file I get an error message: Excel found unreadable content in this workbook.
Do you want to recover the contents of this workbook?

I select yes and it doesn't appear like anything is missing. Does anyone know why this is happening? I found another stackoverflow question about this same issue but for a different program

Error Message after creating XLSX file using java

My R and OS information is below.

R version 3.2.1 (2015-06-18) Platform: i386-w64-mingw32/i386 (32-bit) Running under: Windows 7 x64 (build 7601) Service Pack 1

The code I have been using for the Excel file is:

#create excel workbook for output data
surveyresults_2015v4<-createWorkbook( )

#export catch data to output file
c_data<- createSheet(wb=surveyresults_2015v4, sheetName="catch_data")
addDataFrame(x=datag, sheet=c_data,row.names=FALSE,showNA=F )
saveWorkbook(surveyresults_2015v4, "surveyresults_2015v4.xlsx")
1
It is difficult to diagnose this without a reproducible example. Can you provide a subset of your data that reproduces the error?cdeterman
Real dataset has :1221 rows and 60 columns. Dont know if that has something to do with it.user41509
You overwrote the subset. Just put it in the question above. The size of the dataset shouldn't really matter until it gets 'very large' in which case it would be memory issues.cdeterman
dput(data) structure(list(StationID = c(201501001L, 201501002L, 201501002L, 201501003L, 201501003L, 201501004L, 201501004L, 201501005L, 201501005L, 201501006L), Gear = c("COMM", "COMM", "SURVEY", "COMM", "SURVEY", "COMM", "SURVEY", "COMM", "SURVEY", "COMM"), Totwghtpertow = c(0, 2.58132937508837, 717.022778822871, 8.79478472723868, 754.7170022519, 0, 750.507384562137, 5.10123602652717, 767.398718283106, 0)), .Names = c("StationID", "Gear", "Totwghtpertow"), row.names = c(NA, 10L), class = "data.frame")user41509
sorry - sometimes still trying to figure out this website.user41509

1 Answers

1
votes

If you are downloading the files by a third party software from server then the transfer type maybe the issue. You may be transferring the files in ASCII. Change the transfer type to Binary and see if this works out.