Reputation: 51
I am running the following script
library(xlsx);
wb <- loadWorkbook("/home/.../MyFile.xlsx") #works fine
sh <- getSheets(wb) #works fine
rw <- getRows(sh[[1]]) #-works fine
rc <- getCells(rw) # works fine
v <- lapply(rc, getCellValue) # works fine
v['21.4'] #works fine, returns the correct value
setCellValue(rc['21.4'], 'Hallo') #fails
Error in .jcall(cell, "V", "setCellValue", value) :
java.lang.ClassNotFoundException
after repeating the command
Error in .jcall(cell, "V", "setCellValue", value) :
RcallMethod: cannot determine object class
It happens in RStudio and in the classical R terminal under Ubuntu 12.04 32Bit. Please help!
Upvotes: 5
Views: 1003
Reputation: 1025
I have the same problem in Windows 7 x64 and I think that there is a mistake in 'xlsx' documentation. However instead of
setCellValue(rc['21.4'], 'Hallo')
try
setCellValue(rc[['21.4']], 'Hallo')
Worked for me. Kuba
Upvotes: 5