title: How to Copy Row Height and Column Width From one Excel File to Another
body: <p>I'm trying to copy one excel worksheet from one excel workbook to another excel worksheet in a different excel workbook.</p>
  
  <p>Currently I can copy the values and formatting of all of the cells. The only thing that doesn't work is that the column and row height don't match.</p>
  
  <p>Also, if there are "groupings" (which I'm not sure are technically hidden cells in excel) I need to be able to group those.</p>
  
  <p>Does anyone have a clue how to do this?</p>
  
  <p>As for the row height part at least, I've been trying to figure out how to use the height method. Intially I'm just trying to print out the height dimensions to see if I can iterate over them, but no luck so far.</p>
  
  <pre><code>wb = openpyxl.load_workbook('Documents/test/DISCIPLINEDEQUITYATTR_EAFE_AlphaAttribution_3YRS_20180928_CLPSE.xlsx')
  ws = wb.active
  
  for i in ws.row_dimensions[2].height:
      print(i)
  </code></pre>
  
  <p>But I just get the error TypeError: 'float' object is not iterable</p>
  
  <p>See code below</p>
  
  <pre><code>import openpyxl as xl
  from copy import copy
  
  
  path1 = 'Documents/test/DISCIPLINEDEQUITYATTR_EAFE_AlphaAttribution_3YRS_20180928_CLPSE.xlsx'
  path2 = 'Documents/test/DISCIPLINEDEQUITYATTR_EAFE_AlphaAttribution_3YRS_20180928_CLPSE_COPY.xlsx'
  
  wb1 = xl.load_workbook(filename=path1)
  ws1 = wb1.worksheets[0]
  
  wb2 = xl.load_workbook(filename=path2)
  ws2 = wb2.create_sheet(ws1.title)
  
  for row in ws1:
      for cell in row:
          new_cell = ws2.cell(row=cell.row, column=cell.col_idx, value=cell.value)
          if cell.has_style:
              new_cell.font = copy(cell.font)
              new_cell.border = copy(cell.border)
              new_cell.fill = copy(cell.fill)
              new_cell.number_format = copy(cell.number_format)
              new_cell.protection = copy(cell.protection)
              new_cell.alignment = copy(cell.alignment)
  
  wb2.save(path2)
  </code></pre>