I am using the R package Shiny to develop my own web application.
I have a download button which permits me to export the data into a excel file. In the excel file, there are 4 sheets and in each of them there is a data frame.
For example, in sheet1 there is dataTab1, in sheet2 there is dataTab2, in sheet 3 there is dataTab3 and in sheet4 there is dataTab4.
For doing this, I am using the function downloadHeader() in shiny server.R.
Here is my code:
output$downloadTab <- downloadHandler(
filename ="Tab.xls",
content = function(file) {
#db <- paste(tmpdir,file,sep="/")
channel <- odbcConnectExcel(xls.file = file,readOnly=FALSE)
sqlSave(channel, tab1, tablename = "sheet1",rownames = F)
sqlSave(channel, tab2, tablename = "sheet2",rownames = F)
sqlSave(channel, tab3, tablename = "sheet3",rownames = F)
sqlSave(channel, tab4, tablename = "sheet4",rownames = F)
odbcClose(channel)
},
contentType="application/xls"
)
The code is working very well and when I click on the button "downloadTab" the table results are downloaded in one excel file. The problem is that this code is working on Windows server but it's not working on Linux server.
Do you know how to solve this problem? Do you know how to export an excel file in Linux server?