title: How to replace values present in particular column with openpyxl?
body: <p>I want to replace dates present in a particular format with the standard format of <code>dd-mm-yyyy</code>. Actual date present in the 10th column would be like <code>6.2017</code>, <code>7.2017</code> where <code>7</code> is the month and <code>2017</code> is the year. I just need to add <code>1-</code> before all the values and then I want to replace the dot present in the date value with <code>-</code> (hyphen). So the output looks like <code>1-6-2017</code>, <code>1-7-2017</code>. Note that the column may contain <code>none</code> values. In that case, I want to skip those none values.</p>
  
  <p>This is what I tried,</p>
  
  <pre><code>from openpyxl import load_workbook
  wb = load_workbook(r'E:\foo\Python\stocktable.xlsx')
  ws = wb.get_active_sheet()
  for rownum in range(2, ws.get_highest_row()):
      print(str(ws.cell(row=rownum, column=10).value))
  </code></pre>
  
  <p><strong>Output:</strong></p>
  
  <pre><code>6.2017
  7.2016
  7.2017
  6.2017
  7.2017
  7.2017
  2.2016
  7.2017
  8.2016
  None
  </code></pre>
  
  <p>So I add a litle bit tweak to the above code, to work for my case. But it fails.</p>
  
  <pre><code>from openpyxl import load_workbook
  wb = load_workbook(r'E:\foo\Python\stocktable.xlsx')
  ws = wb.get_active_sheet()
  for rownum in range(2, ws.get_highest_row()):
      ws.cell(row=rownum, column=10).value = '1-' + str(ws.cell(row=rownum, column=10).value.replace('.', '-')
  
  wb.save(r'E:\foo\Python\stocktable.xlsx')  
  </code></pre>
  
  <p>That is, it shows a symtax error like,</p>
  
  <pre><code>File "E:\foo\Python\python-excel.py", line 7
      wb.save() 
       ^
  SyntaxError: invalid syntax
  </code></pre>