Downloading Data after Filteration



I was wondering if someone could help me with this issue. I have a dataframe I've created after reading a CSV. I am using renderDataTable to display the table. Users can come on the Rshiny app and filter the data table by inputting selections from drop down menus. Is it possible to save and download the filtered data-table as a CSV? I have gotten it to download, however, never post filtration.



hi @rara2, yes that should be possible. Do you get an error?

It would be great if you could post a reprex (short for minimal repr oducible ex ample).

Right now the best way to install reprex is:

# install.packages("devtools")

If you've never heard of a reprex before, you might want to start by reading the help page. The reprex dos and don'ts are also useful.

For pointers specific to the community site, check out the reprex FAQ, linked to below.


Yes, you can easily add the download option to you shiny application with downloadButton() or downloadLink() functions.

Here it is an example:

# In server.R:
filtered_data  <- reactive({
        filter(raw_data, Column1==input$value)})

output$downloadData <- downloadHandler(
  filename = function() {
    paste('data-', Sys.Date(), '.csv', sep='')
  content = function(con) {
    write.csv(filtered_data(), con)
# In ui.R:
downloadLink('downloadData', 'Download')

You can access more details in function web page at