JuanFerrer
JuanFerrer

Reputation: 63

R markdown: download a html table to an excel file

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")

Upvotes: 6

Views: 7235

Answers (1)

Ross Dahlke
Ross Dahlke

Reputation: 159

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

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

Upvotes: 10

Related Questions