I am trying to export different arrays to different sheets of an already existing Excel file. The format of this file is .xlsx.
Since I need to have several sheets in the same file, I can’t use “CSV”.
Secondly, it seems to me that “ExcelReaders” works just for reading files, which is great and easy to use, but doesn’t help now in the exporting phase.
Thirdly, I have tried “XLSX” (https://felipenoris.github.io/XLSX.jl/stable/tutorial.html#Writing-Excel-Files-1). It seems to me that if I try to export data in DataFrame format, I am forced to export them to a new Excel file all the times.
However, exporting them as explained in the section “Edit Existing Files” at the same link seems extremely time consuming and would require many lines of code to simply export different arrays to different sheets in the same .xslx file.
Does anyone have any suggestions?
P.S. I am aware that “Taro” exists, however I don’t have Java on my computer and I would like to avoid installing it if possible!
For the sake of completeness, let me just add how to create a new worksheet (if not already existing in the workbook, like it was in my case):
XLSX.openxlsx(file_name, mode="rw") do xf
XLSX.addsheet!(xf, "new sheet name")
sheet = xf # EDIT: this works if there was only 1 sheet before.
# If there were already 2 or more sheets: see comments below.
XLSX.writetable!(sheet, data, columnnames; anchor_cell=XLSX.CellRef("A1"))