title: Pandas xlsxwriter to write dataframe to excel and implementing column-width and border related formatting
body: <p><strong><em>Background</em></strong>:</p>
  
  <p>I am using Pandas and have a <strong>dataframe 'df'</strong> which I intend to write into an Excel sheet. I use the code below and get the output Excel sheet as shown in attached snapshot <strong>'Present.JPG'</strong>:<a href="https://i.stack.imgur.com/SeqUM.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/SeqUM.jpg" alt="Present.JPG"></a></p>
  
  <pre><code>import pandas as pd
  import xlsxwriter
  
  writer = pd.ExcelWriter('output.xlsx', engine='xlsxwriter')
  df.to_excel(writer, sheet_name='Sheet1')
  writer.save()
  </code></pre>
  
  <p><strong><em>Problem description:</em></strong>
  I would like to write the dataframe to Excel and incorporate the following changes.   </p>
  
  <p>1) Get rid of the first column indicating the index<br>
  2) Implement text wrapping on all columns (to auto-size each column width)<br>
  3) Sketch thick border A1 to C4, D1 to F4 and column G  </p>
  
  <p>Eventually, I would like the Excel sheet to look like as shown in snapshot <strong>'Desired.JPG'</strong>:<a href="https://i.stack.imgur.com/aLs7j.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/aLs7j.jpg" alt="Desired.JPG"></a></p>
  
  <p><strong><em>Tried till now:</em></strong>
  I tried the following commands but they over-write the border on to the content of the cells. Furthermore, I am not able to figure out how to extend the border (and text wrapping) beyond a single cell.</p>
  
  <pre><code>writer = pd.ExcelWriter("output.xlsx", engine='xlsxwriter')
  df.to_excel(writer, sheet_name='Sheet1')
  workbook=writer.book
  worksheet= writer.sheets['Sheet1']
  
  full_border = workbook.add_format({"border":1,"border_color": "#000000"})
  link_format = workbook.add_format({'text_wrap': True})
  
  worksheet.write("D3", None, full_border)
  worksheet.write("E1", None, link_format)
  
  writer.save()
  </code></pre>