title: How to use write.xlsx in R when the excel file exists or the sheet exists
body: <p>I am trying to use <code>openxlsx::write.xlsx</code> to write results into Excel spreadsheet in R.</p>
  
  <ol>
  <li><p>if the file exists and a new sheet is to be added, I can use <code>append=T</code>. Instead of using if to check the file, are there any ways to automatically check?</p></li>
  <li><p>if the file and sheet both exist and this sheet is to be updated, how should I do to overwrite the results? Thanks.</p></li>
  </ol>