title: Exporting multiple excel sheets in one workbook R shiny
body: <p><a href="https://drive.google.com/open?id=0BzAJnxmL2vZoeHlNTEotaEpRNTQ" rel="nofollow">link to data in xlsx file (data is in 4th sheet)</a><a href="https://drive.google.com/open?id=0BzAJnxmL2vZodmJSRU1XWnNVSHM" rel="nofollow">,link to data in csv file</a><br>
      library(shiny)
      library(xlsx)</p>
  
  <pre><code>shinyUI(fluidPage(
  
    titlePanel("Tim O'Leary"),
    sidebarLayout(
      sidebarPanel(
        fileInput('file1', 'Choose File',
               accept=c('text/csv', 
                       'text/comma-separated-values,text/plain', 
                       c(".txt",'.csv'))),
    downloadButton('downloadData', 'Download'),
    tags$hr(),
    checkboxInput('header', 'Header', TRUE),
    radioButtons('sep', 'Separator',
                 c(Comma=',',
                   Semicolon=';',
                   Tab='\t'),
                 '\t'),
    radioButtons('quote', 'Quote',
                 c(None='',
                   'Double Quote'='"',
                   'Single Quote'="'"),
                 '"')
  
  ),
  mainPanel(
  
    #tableOutput('contents')
    tabsetPanel(
      tabPanel("RawTable", tableOutput('contents')),
      tabPanel("Table1", tableOutput('a')),
      tabPanel("Table2", tableOutput("b")),
      tabPanel("Table3", tableOutput("c"))
  
    )
   )
    )
   ))
  
   library(shiny)
    library(xlsx)
  
   shinyServer(function(input, output) {
  
   rawData &lt;- reactive({
   filet &lt;- input$file1
     if(is.null(filet)) return()
     data &lt;- read.csv(filet$datapath)
     })
  
    #dtableInput&lt;- reactive({
         # if(is.null(rawData())) 
    #   return()
    #  data&lt;-rawData()        
     #})
  
     a &lt;- reactive({
       a &lt;- subset(rawData(), AssertionString == "10046")
      a
   })
  
    b &lt;- reactive({
     b &lt;- subset(rawData(), AssertionString == "10074")
     b
    })
  
   c &lt;- reactive({
     c &lt;- subset(rawData(), AssertionString == "10179")
     c
   })
  
   # workBook &lt;- reactive({
  #    processor &lt;- createWorkbook()
   #    page1 &lt;- createSheet(wb=processor, sheetName="iam")
    #   page2 &lt;- createSheet(wb=processor, sheetName="tim")
    #  page3 &lt;- createSheet(wb=processor, sheetName="oleary")
     # page4 &lt;- createSheet(wb=processor, sheetName="J")
     #addDataFrame(x=rawData(), sheet=page1)
  #    addDataFrame(x=a(), sheet=page2)
   #   addDataFrame(x=b(), sheet=page3)
    #  addDataFrame(x=c(), sheet=page4)
    # wb &lt;- saveWorkbook(processor,"processorData")
   #  wb
   #})
  
   output$contents &lt;- renderTable({
         rawData()
        })
  
       output$a &lt;- renderTable({
            a()
         })
  
         output$b &lt;- renderTable({
         b()
          })
  
       output$c &lt;- renderTable({
          c()
             })
  
          output$downloadData &lt;- downloadHandler(
        filename = function() {paste("file_name", '.cvs')},
         content = function(file){
           write.csv(a(), file="file_name")
            #write.xlsx2(a(), file="file_name.xlsx", sheetName="sheet1")
              #write.xlsx2(b(), file="file_name.xlsx", sheetName="sheet2",                                    append=T)
         })
  #rbind allows you to connect dfs in column like manner
  
       })
  </code></pre>
  
  <p>These are my ui and server scripts in r shiny and I'm trying to export the dataframes rawData,a,b,and c into an excel workbook with each dataframe having its own sheet.  I have tried reading in a csv file and exporting it that way but I cannot find a function that allows me to export these the way I need to using write.csv.  I then tried importing as .xlsx and used write.xlsx2 because the rawData is too big for just write.xlsx, and when I used write.xlsx2 upon clicking my download button, it would just load for an endless amount of time but never download anything.  Any help or advice will be appreciated thanks</p>