title: How to append result of for loop in excel file?
body: <p>I have a .txt file with a list of keywords, I read this file and for each keyword generate some kind of string. I would like to append this string generated for each keyword to excel file. I'd like also that each time I re run the script and read .txt file with new keywords, result is always appended to the same excel file instead of overwriting it.</p>
  
  <p>I have tried this, but not sure if <code>openpyxl</code> is a good method, also I get an error: </p>
  
  <blockquote>
    <p>raise ValueError("{0} is not a valid column name".format(str_col))
    ValueError: tapis roulant elettrico  is not a valid column name
    for line 
    page.append(some_result)</p>
  </blockquote>
  
  <pre><code>from openpyxl.workbook import Workbook
  from openpyxl import load_workbook
  
  headers = ['data']
  workbook_name = 'Example.xlsx'
  wb = Workbook()
  page = wb.active
  page.title = 'data'
  
  page.append(headers)
  some_result = {}
  val = "some result"
  
  with open("keywords.txt", "r") as file:
      for line in file:
          some_result = {line: val}
          page.append(some_result)
          wb.save(filename=workbook_name)
  file.close()
  </code></pre>