6

I have a R markdown where I built a table and I want to add the option to download the table to a excel file.

kable(MyTable) %>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed", 
  "responsive")) %>%
  scroll_box(width = "900px", height = "500px")
Waylan
  • 37,164
  • 12
  • 83
  • 109
JuanFerrer
  • 63
  • 1
  • 4
  • 2
    Your question is not about `knitr` or `kableExtra`, it's about `shiny` and handling file downloads. Take a look at [`shiny::downloadHandler`](https://shiny.rstudio.com/gallery/download-file.html). – r2evans Dec 11 '18 at 16:30
  • 3
    The point is that we do not want to use a shiny app but a r markdown html – JuanFerrer Dec 13 '18 at 15:43

1 Answers1

9

You could always try using DT::datatable to get export buttons

MyTable %>%
  DT::datatable(
    extensions = 'Buttons', 
    options = list(dom = 'Bfrtip', 
                   buttons = c('excel', "csv")))
Ross Dahlke
  • 149
  • 3