title: How to convert n rows of xlsx to csv in Python while preserving date values
body: <p>I am trying to convert an xlsx file to one CSV file containing the header and another CSV file containing the actual data.
  I have the following requirements:</p>
  
  <ol>
  <li>Header does not start at first row but at row <code>start_line</code>.</li>
  <li>Dates should not be considered as floats but in some string format.</li>
  <li>I don't know the total number of rows or columns of the file beforehand. I also don't want to specify which column is a date.</li>
  </ol>
  
  <p>Using <code>pandas</code> I get stuck at number 1.
  I wanted to achieve this in two separate reads where I read from start_line to <code>start_line+1</code> and from <code>start_line+1</code> to the end.
  However it seems like it is <a href="https://stackoverflow.com/questions/35747476/in-pandas-whats-the-equivalent-of-nrows-from-read-csv-to-be-used-in-read-ex">not possible</a> to read n lines from an offset. Below is the code I use to just get one file including the header.</p>
  
  <pre><code>import pandas as pd
  def parse_excel(file,start_line,sheet,table):
      sh = pd.read_excel(file,sheet,skiprows=start_line)
      sh.to_csv("output.csv",sep='\t',encoding='utf-8',index=False)
  </code></pre>
  
  <p>Next I have tried this using <code>xlrd</code> but this library treats all dates as floats like in Excel. The only workaround here seems to <a href="https://stackoverflow.com/questions/3727916/how-to-use-xlrd-xldate-as-tuple">go through all individual cells</a> which does not seem very efficient or well coded. What I have now:</p>
  
  <pre><code>import xlrd
  def parse_excel(file,start_line,sheet,table):
      with xlrd.open_workbook(file) as wb:
          sh = wb.sheet_by_name(sheet)
          header_written = False
          with open('{0}.csv'.format(table),'wb') as csv_file:
              wr = csv.writer(csv_file,delimiter='\t')
              for rownum in range(sh.nrows):
                  if not header_written and start_line == rownum:
                      with open('{0}_header.csv'.format(table),'wb') as header:
                          hwr = csv.writer(header,delimiter='\t')
                          hwr.writerow(sh.row_values(rownum))
                          header_written = True
                  elif header_written:
                      wr.writerow(sh.row_values(rownum))
  </code></pre>
  
  <p>Please point me to other solutions/libraries, show a workaround for either one of the above or explain why I should go for the <code>xlrd</code> workaround checking each individual cell.</p>