I have built an app which gives an output data table based on the filter selected. Suppose I change the filter 10 times and it gives me 10 results. I need to store the results in 10 sheets in single excel.
For example: Select filter option: A Get the Output: Output1 Click on Download button. Save results as sheetname: test1, excel: sample1.xlsx
Now I Select filter option: B Get the Output: Output1 Click on Download button. Save results as sheetname: test2, excel: sample1.xlsx
This is my code
output$downloadData1 <- downloadHandler(
filename = function()
{ paste('Sample','_', Sys.Date(), ".xlsx", sep="") },
content = function(file) {
write.xlsx(makeTable(), file, sheetName =input$sampleselect, row.names = FALSE , append = TRUE)
})
sampleselect is the filter selection and I am also passing this as the sheet name.
currently, this code throws out unique Excel files. i.e For filter A: it creates an Excel Sample.xlsx and for filter B: it creates an Excel also named Sample.xlsx
Thanks in advance.