title: Converting an excel tab to a CSV file is casting my columns into floats. Need to change to String
body: <p>So I have been reading through the documentation for both <a href="https://openpyxl.readthedocs.io/en/stable/" rel="nofollow noreferrer">openpyxl</a> and <a href="https://docs.python.org/3/library/csv.html" rel="nofollow noreferrer">csv</a> and I can seem to figure this one out. What I'm doing is taking a Excel workbook and converting one of the tabs into a csv. Then, with said CSV, preforming some ETL.</p>
  <p>My issue is, in the final CSV, I have a column that is a mix of numbers and strings.
  And my issue is that, in excel it looks fine but in notepad++ you can see the floating points being added. I need this column to remain as strings.</p>
  <p>In my ETL code I have casted this column to a string, but all that does is it turns the floats from excel to csv conversion, and transforms them into strings but still with the .0 added.</p>
  <p><a href="https://i.stack.imgur.com/KYYrp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KYYrp.png" alt="enter image description here" /></a></p>
  <p>Code for cast to string in ETL</p>
  <pre><code>df['Old Serial Number'] = df['Old Serial Number'].astype(str)#Old Serial Number is the column with a mix of strings and INT'S (see notepad++ image) 
  </code></pre>
  <p>Is there away that I can cast columns as strings at the point of the CSV creation so i can drop the floats?</p>
  <p>This is the code I'm using for the conversion.</p>
  <pre><code>import openpyxl
  import csv
  import glob
  import datetime
  import shutil
  import time
  import logging
  
  def convert_to_csv():
  for filename in glob.glob(
          r&quot;C:\Users\excel_file_that_i_want*&quot;):
      wb = openpyxl.load_workbook(filename)
      sh = wb['Report']#excel tab i want from the workbook
  
      with open('excel_file_that_i_want' + datetime.datetime.today().strftime('%d%m%Y%H%M%S''.csv'), 'w', encoding='utf-8',
                newline=&quot;&quot;) as f:
          col = csv.writer(f,
                           quotechar='&quot;', quoting=csv.QUOTE_ALL)
          for row in sh.rows:
              col.writerow([cell.value for cell in row])
  logging.info('Excel file converted to CSV')
  </code></pre>