title: R - Autofit Excel column width
body: <p>How do I autofit the column width using <code>openxlsx</code>?</p>
  
  <p>One of my columns has a date variable (eg. <code>21-08-2017</code>) and if copied using <code>ctrl+c</code> from Excel, and pasted normally elsewhere, it shows like <code>#######</code>(if column width is increased to show the content in Excel, it pastes normally). I want to integrate that repeatitive task into my code. Here is what I am using right now:</p>
  
  <pre><code>WB &lt;- loadWorkbook(File)
  addWorksheet(WB, Sheet)
  writeDataTable(WB, Sheet, DF, withFilter=F, bandedRows=F, firstColumn=T)
  saveWorkbook(WB, File,  overwrite =TRUE)
  </code></pre>
  
  <p>I have attached the whole relevant code here, I am also doing conditional formatting based on the table values. <strong>Please suggest an way to integrate autofit column width in here.</strong></p>
  
  <p>EDIT:
  By default, XLSX outputs from R has the default 8.43 columnwidth, I want to either set it to autofit as per cell contents, or set it manually for each column.</p>
  
  <p>To Mod: This is a problem I am trying to solve in R, using openxlsx. Anyway, thanks for the attention.</p>