title: how do I format an entire column (or cells I can iterate thru)as text format using openpyxl
body: <p>I need help with how to change excel columns to text before the python script copies them from one file to another file</p>
  
  <p>currently using openpyxl....
  but open to any library that does the job and doesnt lose any of the other formatting or coloring in the worksheets</p>
  
  <p>the problem is, when something has a date in it, I need it to copy as straight text, and not as a date</p>
  
  <p>so when somebody has typed 6/17/2019... its stays as EXACTLY that
  instead of getting changed into something like 2019-06-17 0:00:00</p>
  
  <p>I <em>think</em> the right place to do it would be right after I load each workbook.
  I know if I manually change the files so that the columns needed are formatted as "text", the script works perfect and everything copies as intended.</p>
  
  <p>I'm looking for a function in openpyxl that is teh same thing as right clicking the cell in excel, selecting formatting, and choosing "text"</p>
  
  <pre><code># open both files, load them in, 
  #Change Columns F and H to Text Formatting before doing the next part of the script
  
  
  
  
  
  
  
  #Begin Openpyxl Section
  
  orig_wb = load_workbook('old_qc_report.xlsx')
  new_wb = load_workbook('new_qc_report.xlsx')
  
  
  sheetlist = orig_wb.get_sheet_names()
  sheet = orig_wb.get_sheet_by_name(sheetlist[0])
  sheetlist2 = new_wb.get_sheet_names()
  sheet2 = new_wb.get_sheet_by_name(sheetlist[0])
  
  
  s1rownumber = 1
  for s1row in sheet.iter_rows(min_row=2, max_row= sheet.max_row, min_col=6, max_col=6, values_only=True):
    s1rownumber +=1
    for cell in s1row:
      if cell != None:
  #      print(cell)
        transfer_cust_rec = cell
        product_description_ref = sheet[str("A" + str(s1rownumber))].value
        order_No_ref = sheet[str("C" + str(s1rownumber))].value
  #      print(product_description_ref)
  #      print(order_No_ref)
  
        s2rownumber = 1
        for s2row in sheet2.iter_rows(min_row = 2, min_col=1, max_col=1, values_only=True):
          s2rownumber +=1
          for cell2 in s2row:
            if cell2 == product_description_ref:
              if sheet2[str("C" + str(s2rownumber))].value == order_No_ref:
                sheet2[str("F" + str(s2rownumber))].value = transfer_cust_rec
  
  
  s1rownumber = 1
  for s1row in sheet.iter_rows(min_row=2, max_row= sheet.max_row, min_col=8, max_col=8, values_only=True):
    s1rownumber +=1
    for cell in s1row:
      if cell != None:
  #      print(cell)
        transfer_notes = cell
        product_description_ref = sheet[str("A" + str(s1rownumber))].value
        order_No_ref = sheet[str("C" + str(s1rownumber))].value
  #      print(product_description_ref)
  #      print(order_No_ref)
  
        s2rownumber = 1
        for s2row in sheet2.iter_rows(min_row = 2, min_col=1, max_col=1, values_only=True):
          s2rownumber +=1
          for cell2 in s2row:
            if cell2 == product_description_ref:
              if sheet2[str("C" + str(s2rownumber))].value == order_No_ref:
                sheet2[str("H" + str(s2rownumber))].value = transfer_notes
  
  
  new_wb.save(outfilepath)
  
  
  wb.close
  
  os.remove("old_qc_report.xlsx")
  os.remove("new_qc_report.xlsx")
  
  print("\nThis program took %2.3f seconds to run\n"%(time.time() - start_time))
  time.sleep(3)
  </code></pre>