1

I try to export three dataframes to a single calc file (ods), but I don't see how to specify the sheet I'm writing into.

I tried the readODS package which has a write_ods function, but in the documentation I see not mention of a sheet specification.

Malta
  • 1,883
  • 3
  • 17
  • 30

2 Answers2

2

Don't know how it was 4 years ago but now there is an option to append to the ods file.

write_ods(df1, filename, sheet = "df1")

write_ods(df2, filename, sheet = "df2", append = TRUE)
xilliam
  • 2,074
  • 2
  • 15
  • 27
1

What exactly is your problem?

When you have a data.frame and export it using readODS::write_ods, then your output is a .ods file. Or do you want to export mutliple data.frames in one file using multiple sheets?

dasds
  • 170
  • 1
  • 11
  • I edited my question, I hope it's clearer now. I want to write several data frames in a single ods. – Malta Nov 29 '17 at 11:44
  • short description from the rio package: OpenDocument Spreadsheet (.ods), using write_ods. (Currently only single-sheet exports are supported.) Can you use the write.xlsx from the openxlsx package, open it in your program and convert it to an .ods file? It is a bit of a detour, but hopefully it solves your problem. – dasds Nov 29 '17 at 11:49
  • that would be a workaround, but I try to automatise my process as much as possible, so not ideal. – Malta Nov 29 '17 at 15:06
  • 1
    to automatise at least a bit you can save the data.frames in a list `list_save <- list(df1 = df1, df2 = df2, df3 = df3)` and pass the list to the `write.xlsx` function – dasds Nov 29 '17 at 15:17
  • ok thank you. Has anyone some tips for automatise the "convert xls to ods" part ? – Malta Nov 30 '17 at 07:15