R Shiny: How to download multiple editable datatable outputs in R Shiny in one xlsx file with multiple sheets

I have 3 dataTableOutput in 3 different tabs in a Shiny app. My objective is to have a single download button, different from the download button that dataTable (from library DT) provides in the sense that this download button should be able to fetch all the 3 dataTable outputs and download them as separate sheets in a single xlsx. file. I have successfully uploaded the 3 sheets from a single xlsx file to my app but now I want to edit it in Shiny and download it back in the same way.
So far my server code -

shinyServer(function(input, output, session){
output$table1 <- renderDataTable({
      inFile <- input$file
      
      if(is.null(inFile))
        return(NULL)
      file.rename(inFile$datapath,
                  paste(inFile$datapath, ".xlsx", sep=""))
      read_excel(paste(inFile$datapath, ".xlsx", sep=""), sheet = 1)
      
    }, filter="top", class = 'hover cell-border stripe', editable= TRUE,extensions= 'Buttons',
    options = list(dom = 'Bfrtip',pageLength =10,
                   buttons = c('copy','csv','excel','pdf','print'), scrollX=TRUE),server=FALSE)
    
output$table2 <- renderDataTable({
      inFile <- input$file
      
      if(is.null(inFile))
        return(NULL)
      file.rename(inFile$datapath,
                  paste(inFile$datapath, ".xlsx", sep=""))
      read_excel(paste(inFile$datapath, ".xlsx", sep=""), sheet = 2)
    }, filter="top", class = 'hover cell-border stripe', editable= TRUE,extensions= 'Buttons',
    options = list(dom = 'Bfrtip',pageLength =10,
                   buttons = c('copy','csv','excel','pdf','print'), scrollX=TRUE),server=FALSE)
    

output$table3 <- renderDataTable({
      inFile <- input$file
      
      if(is.null(inFile))
        return(NULL)
      file.rename(inFile$datapath,
                  paste(inFile$datapath, ".xlsx", sep=""))
      x<-read_excel(paste(inFile$datapath, ".xlsx", sep=""), sheet = 3)
    }, filter="top", class = 'hover cell-border stripe', editable= TRUE,extensions= 'Buttons',
    options = list(dom = 'Bfrtip',pageLength =10,
                   buttons = c('copy','csv','excel','pdf','print'), scrollX=TRUE),server=FALSE)

    output$tb <- renderUI({
      if(is.null(input$file)) {return()}
      else
        tabsetPanel(

          tabPanel("Table1", dataTableOutput("table1"),
            box( title = "Error Log", status = "danger", solidHeader = TRUE,
              collapsible = TRUE,
              textOutput("text1"))),
          tabPanel("Table2", dataTableOutput("table2"),box( title = "Error Log", status = "danger", solidHeader = TRUE,
                                                                  collapsible = TRUE,
                                                                  textOutput("text2"))),
          tabPanel("Table3", dataTableOutput("table3"),box( title = "Error Log", status = "danger", solidHeader = TRUE,
                                                            collapsible = TRUE,
                                                            textOutput("text3")))
)
})