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)
1
  • Have you considered using the openxlsx package instead? It doesn't require rJava (simpler), and if you start with 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. Commented Jan 13, 2023 at 3:54

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.