title: Openpyxl fill formula in Excel column
body: <p>I am working in Python 3.6.2 and openpyxl and I have a formula in an Excel column that I need to fill in for the entire column of data. </p>
  
  <p>The formula is :</p>
  
  <p>=TEXT(G2, "00") so I want G2 to increment to G3, G4 and so on down the column.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>import openpyxl
  
  wb = openpyxl.load_workbook("Workbook.xlsx")
  ws = wb.get_sheet_by_name('Data')
  
  
  n = '=TEXT(G2, "00")'
  for row, cellObj in enumerate(list(ws.columns)[10]):
      print (cellObj)
      n = '=TEXT(G%d, "00")' % (row, row, row)
  
      cellObj.value = n
  wb.save('Workbook.xlsx')
  wb.close()
  </code></pre>
  
  <p>I am getting an error:</p>
  
  <p>AttributeError: 'str' object has no attribute 'columns'</p>
  
  <p>Thank you in advance for any help that you can provide.</p>
  
  <p><strong>Edit 1:</strong></p>
  
  <p>It is really a duplicate of this question</p>
  
  <p><a href="https://stackoverflow.com/questions/45948778/openpyxl-formula-filling-for-entire-column">Openpyxl Formula filling for entire column</a></p>
  
  <p>However I cannot get the example there to work either. I am getting a very annoying syntax error.</p>