title: openpyxl reading column width from a .xlsx and writing it to a new .xlsx: width is different in a new file
body: <p>I am using openpyxl to work with <code>.xlsx</code> files in <code>Python</code>.</p>
  
  <p>I have a <code>sample.xlsx</code> file from which I want to get a list of title fields and column width to use in the file generated by my script.</p>
  
  <p>At first I create a list with column names and their corresponding widths.
  So I use:</p>
  
  <pre><code>filter_list = {"name": [], "width": []} 
  row_count = sheet.max_row 
     for i in range(row_count): 
        cell = sheet.cell(row, i + 1) 
        if cell.value: 
          filter_list["name"].append(cell.value)
          filter_list["width"].append(sheet.column_dimensions
               [cell.column].width)  
  </code></pre>
  
  <p>value to get column widths and then I set the same value:</p>
  
  <pre><code>if filter_list["width"][i] is not None: 
      sheet.column_dimensions[cell.column].width = filter_list["width"][i]
  </code></pre>
  
  <p>It works fine if a particular column has a non-default value (i.e. not None). When I open the output file (on both Mac and Windows) I see that the width of this particular column is the same for both files.</p>
  
  <p>But if one of the columns has ...width = <code>None</code> in the input file (so the output file have the same <code>None</code> value for column width parameter) the same column in the output file looks different.</p>
  
  <p>Any ideas on why it happens?</p>
  
  <p>It looks like somewhere in the <code>.xlsx</code> there is a parameter, which somehow defines what the default width (= None value) is set to.</p>
  
  <p>Is there any way to make both files look the same in terms of column width?</p>
  
  <p><strong>Update:</strong> I added a check for width value of <code>None</code>. I only set the column width parameter for columns that have not <code>None</code> value. The result is still the same - files are different in terms for default width.</p>
  
  <p><strong>Update 2:</strong> I have updated the code to show exactly how I read and set column width.</p>