0

I'm trying to write an Excel worksheet with the XLConnect package. The data I'm using is a data.frame (820*132). Once I'm done building the dataset, I'm using the writeWorksheetToFile function to export.

If the file does not exist yet and I am creating it from scratch, everything works well.

If I want to overwrite an existing sheet, the function takes approximately a minute to write and in addition, when I open the excel file, I have an error message saying: "we found a problem with some content in 'my_file.xlsx. Do you want to try to recover as much as we can?"

I tried to use other packages to write to excel like xlsx and openxlsx but they do not allow to overwrite a sheet without overwriting the entire workbook.

I've checked a few solutions such as this, but I not optimal.

I am looking for the most optimal way of writing excel worksheets, with an overwrite option that is suitable for large datasets.

I'm using the latest versions of R and RStudio.

My Excel verion is 1902, 64bits.

  • 1
    Hello, it would be fine if you could provide a reproductible code ... t'is hard to help you not seing what code you wrote .. – MrSmithGoesToWashington Sep 02 '19 at 17:12
  • Sorry, I edited my query. I am not really looking for a debug solution, more for advise on the best packages, methods to use. – La Chouette Sep 03 '19 at 09:54
  • So did you try anything with `officer` package ? Another thing you can pay attention to is the location of your existing excel file : is it on you local disk, or on a remote repository .. In the second case, it could be more longer to write on the file, than to copy it on your local disk, write in it from R and then copy it back to it's original location. – MrSmithGoesToWashington Sep 05 '19 at 12:22

0 Answers0