Write Excel file without row numbers for multiple sheets?

Hi there,

Does anyone know how to remove the first column of automated row numbers when writing sheets to Excel via a loop? I've tried the row.names=F option in the below code:

write.xlsx(x, "file.xlsx", sheetName = sheets[i], row.names=F, append=T)

But then I get this error:

Error in .jcall(cell, "V", "setCellValue", value) : 
  method setCellValue with signature ([Ljava/lang/String;)V not found
In addition: Warning message:
In if (is.na(value)) { :
  the condition has length > 1 and only the first element will be used

I also tried

x <- x[,-1]

But that removed one of my real columns and not the first column that R creates when creating an Excel file. It works when I don't have the row.name=F function, so it's not a problem with the rest of the code. Any help would be greatly appreciated!

Thanks so much!

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.