title: How to append a new sheet to existing Excel workbook?
body: <p>I have exported my dataframe into 3 different Excel workbooks based on their &quot;Country&quot; and I have another dataframe that have the same exact countries and I would like them to be exported to the current existing workbook in which I have created.</p>
  <pre><code>#Create Dataframe
  df = data.frame(Year = c(2018,2019,2020,2018,2019,2020,2018,2019,2020),
                  Country = c(&quot;Germany&quot;,&quot;Germany&quot;,&quot;Germany&quot;, &quot;Japan&quot;, &quot;Japan&quot;, &quot;Japan&quot;,  &quot;Thailand&quot;, &quot;Thailand&quot;, &quot;Thailand&quot;), 
                  Count = c(17, 15, 60, 23, 25, 60, 50, 18, 31))
  
  df2 = data.frame(Country = c(&quot;Germany&quot;,&quot;Germany&quot;,&quot;Germany&quot;, &quot;Japan&quot;, &quot;Japan&quot;, &quot;Japan&quot;,  &quot;Thailand&quot;, &quot;Thailand&quot;, &quot;Thailand&quot;), 
                  Count = c(&quot;James&quot;, &quot;Gordon&quot;, &quot;Jackson&quot;, &quot;Harrison&quot;, &quot;Reid&quot;, &quot;Ashen&quot;, &quot;Lewis&quot;, &quot;Maokai&quot;, &quot;Federick&quot;))
  
  #Split dataframe according to their Countries
  splitdf = split(df, df$Country)
  
  #Write workbook
  save_data &lt;- function(df, name) {
    wb &lt;- createWorkbook()
    addWorksheet(wb, name)
    writeDataTable(wb, name, df, tableStyle = &quot;TableStyleLight9&quot;)
    saveWorkbook(wb, paste0(name, &quot;.xlsx&quot;), overwrite = TRUE)
  }
  
  #Print workbook
  mapply(
    save_data,
    splitdf,
    names(splitdf)
  )
  
  </code></pre>
  <p>Is there a way for me to append df2 to a new sheet based on it's unique Countries to the existing Workbooks that I have created without overwriting the original file?</p>