title: how to read, display and download excel using modularized shiny app
body: <p>All I am trying to do is read, render and download excel. Not sure how we can display specific UI details such as uploading excel button in dashboard sidebar and rendering and download button in dashboard body</p>
  
  <p>Only error when I tried to get rid this error in mod_exampleUI module function.
  <strong>Error in mod_example("example_mod") : 
    argument "output" is missing, with no default</strong></p>
  
  <p>Please find the code below</p>
  
  <pre><code>library(shiny)
  library(magrittr) # Load magrittr for the piping operator %&gt;%
  library(DT)
  library(readxl)
  library(tidyselect)
  library(writexl)
  library(dplyr)
  library(tidyr)
  library(readxl)
  library(stringr)
  # Increase band width for shiny to handle bigger file 
  options(shiny.maxRequestSize=300*1024^2) 
  
  # Module UI to display sidebar content
  mod_exampleUI &lt;- function(id) {
    ns &lt;- shiny::NS(id)
    shiny::tagList(
  
      fileInput(ns("file1"), "Choose XLSX File (Convert xls to xlsx)",accept=c(".xlsx")),
      tags$hr(),
      downloadButton(ns("downloadData"), "Download")
    )
  }
  
  # Module UI to display Body content
  mod_example_displayUI &lt;- function(id) {
    ns &lt;- shiny::NS(id)
    shiny::tagList(
      DT::dataTableOutput(ns("contents"))
    )
  }
  
  # Function to read all excel sheet necessary
  mod_example_display &lt;- function(input, output, session) {
    output$contents &lt;- DT::renderDataTable({
      DT::datatable(readxl::read_excel(input$file1$datapath)
                    ,options = list(pageLength = 7,scrollX = TRUE))
    })
  
    output$downloadData &lt;- downloadHandler(
      filename = function() {
        paste("updated file dated-", Sys.Date(), ".xlsx")
      },
  
      content = function(file) {
        write_xlsx(DT::datatable(readxl::read_excel(input$file1$datapath),file))
      }
    )
  }
  
  ui &lt;- fluidPage(
  
    shinydashboard::dashboardPage(
      skin = "yellow",
      # HEADER -----
      shinydashboard::dashboardHeader(
        title = "Modularizing App"
      ),
      # SIDEBAR -----
      shinydashboard::dashboardSidebar(
        shinydashboard::sidebarMenu(
          shinydashboard::menuItem('Example', tabName = 'example', icon = shiny::icon('file')),
          shinydashboard::tabItems(
            shinydashboard::tabItem("example", mod_exampleUI("example_sidemod"))
          )
        ) 
      ),
      # BODY -----
      shinydashboard::dashboardBody(
        shiny::tags$head(shiny::tags$link(rel = "stylesheet", type = "text/css", href = "custom.css")),
        shinydashboard::tabItems(
          shinydashboard::tabItem("example", mod_example_displayUI("example_bodymod"))
        )
      )
    )
  )
  
  server &lt;- function(input, output) {
      shiny::callModule(mod_example_display, "mod_example")
  }
  
  shinyApp(ui,server)
  
  </code></pre>