Reputation: 2886
I have a shiny
server set up on a Linux instance
I have a folder called templates which has a excel file template
The user goes to the web page and presses a download button and in theory they should be able to download the template wherever they like on their local machine.
I have seen the code from the post Shiny download file not working
When i try and run it i get a file saved to my downloads
on my windows laptop and it is called NA not the name Template.xlsx
My two questions are
XLSX
The pseudo code is
ui <- shinyUI(fluidPage(
# Side Panel with Options
fluidRow(
column(4, wellPanel(
id = "leftPanel",
div(
id = "Header",
h3("Options"),
tags$hr()
),
div(
h4("1. Download the empty excel template"),
downloadButton("downloadBtn", "Download Excel Template")
)
)))))
# Define server logic required
server <- shinyServer(
function(input, output) {
output$downloadBtn <- downloadHandler(
filename = function() {
paste(input$filenames, sep='')
},
content = function(file) {
myfile <- srcpath <- '/home/foo/Save to Database/templates/Template.xlsm'
file.copy(myfile, file)
}
)})
Upvotes: 0
Views: 5234
Reputation: 4072
You are using paste(input$filenames, sep='')
but you don't have input$filenames defined in the UI part. It should work if you replace that line with "Template.xlsm"
Upvotes: 1