1

I've looked all over and every solution I've found does not work for me. When I use the XLSX package with this syntax:

wb <- loadWorkbook(file path)
sheets <- getSheets(wb)
isotope <-sheets[[5]]
addDataFrame(mydataframe, isotope, row.Names = FALSE, col.names = FALSE, startRow = 9)
saveWorkbook(wb, new file path & name)

All of the data for each column is saved into a single cell. However! If I set row.names and col.names to TRUE, the data copies over correctly (although I get a column and row I don't need). Unfortunately there are formulas in the Excel sheet I'm trying to put the data in so the data frame needs to come over all clean.

   wb <- loadWorkbook(file path)
    sheets <- getSheets(wb)
    isotope <-sheets[[5]]
    addDataFrame(mydataframe, isotope, row.Names = FALSE, col.names = FALSE, startRow = 9)
    saveWorkbook(wb, new file path & name)
Jilber Urbina
  • 58,147
  • 10
  • 114
  • 138
Sean Moore
  • 11
  • 1
  • Have you considered using the `openxlsx` package instead? It doesn't require `rJava` (simpler), and if you start with https://stackoverflow.com/a/34242877/3358272 and add (say) `startRow=5, startCol=3` to the `writeData` call, you can control exactly where (on each sheet) data is placed. – r2evans Jan 13 '23 at 03:54

0 Answers0