f.a
f.a

Reputation: 101

how to write multiple dataframe to multiple sheet of one csv excel file in R?

I am trying to write multiple dataframe to a single csv formated file but each in a different sheet of the excel file:

write.csv(dataframe1, file = "file1.csv",row.names=FALSE)
write.csv(dataframe2, file = "file2.csv",row.names=FALSE)

is there any way to specify the sheet along with the csv file in this code and write them all in one file?

thank you in advance,

Upvotes: 1

Views: 15538

Answers (2)

Taylor White
Taylor White

Reputation: 674

The xlsx and XLConnect packages will do the trick as well.

Upvotes: 0

Arun Raja
Arun Raja

Reputation: 1674

This is not possible. That is the functionality of csv to be just in one sheet so that you can view it either from notepad or any other such software. If you still try to write it would get over ridden. Just try to open a csv and open a new sheet and just write some values and save it. The values which were already there is erased. one excel file in csv format can have only one sheet.

Upvotes: 4

Related Questions