title: Xlsxwriter, formatting just some cells, not whole row or whole column?
body: <p>I have a dataframe that I am sending to Excel using the xlsxwriter engine, then applying formatting to a sheet before closing it. How can I only set a bg color for the columns that have data in them?</p>
  
  <p>For example, I am able to add a yellow background color to the second column (below), but it extends past the cells that have data in them. I am doing this with set_column() as below:</p>
  
  <pre><code>worksheet.set_column(1, 1, 18, hilite_format)
  </code></pre>
  
  <p>I don't see an option to set column format for only certain rows, or to use set_row() to only format certain columns. I've already written the data to the worksheet, so I can't use worksheet.write() or it will overwrite the data that is already in there. At least I don't see any way to use .write() to just apply the formatting without writing data or None into the cells.</p>
  
  <p>Is there a way to just 'paint' some formatting over a range of cells without affecting the values in those cells? I would prefer not to have to use conditional formatting or to re-write the data for these cells just to be able to get the formatting right.</p>
  
  <p>Thank!</p>
  
  <p><a href="https://i.stack.imgur.com/YxR2a.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YxR2a.png" alt="enter image description here"></a></p>