Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. library(shiny)
  2. library("xlsx")
  3.  
  4. ui<-fluidPage(
  5. fileInput("file1","Choose xlsx file",
  6. accept = c(".xlsx")),
  7. downloadButton("file2","Download Modified File")
  8. )
  9.  
  10. server <- function(input, output){
  11.  
  12. output$contents <- renderTable({
  13.  
  14. req(input$file1)
  15. f1 <- cbind(read.xlsx(input$file1$datapath,3),
  16. read.xlsx(input$file1$datapath,4))
  17. })
  18.  
  19. output$downloadData <- downloadHandler(
  20. filename = function() {
  21. paste(output$file2$datapath,"xlsx",sep = ".")
  22. },
  23. content = function(file) {
  24. write.xlsx(f1, file)
  25. }
  26. )
  27. }
  28.  
  29. shinyApp(ui=ui, server=server)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement