title: Leave dates as strings using read_excel function from pandas in python
body: <p><strong>Python 2.7.10</strong><br />
  <strong>Tried pandas 0.17.1 -- function read_excel</strong><br />
  <strong>Tried pyexcel 0.1.7 + pyexcel-xlsx 0.0.7 -- function get_records()</strong></p>
  <p>When using pandas in Python is it possible to read excel files (formats: <em>xls, xlsx</em>) and leave columns containing <strong>date</strong> or <strong>date + time</strong> values as <strong>strings</strong> rather than <em><strong>auto-converting</strong></em> to <code>datetime.datetime</code> or <code>timestamp</code> types?</p>
  <p>If this is not possible using pandas can someone suggest an alternate method/library to read <em>xls, xlsx</em> files and leave date column values as strings?</p>
  <p>For the <strong>pandas</strong> solution attempts the <code>df.info()</code> and resulting date column types are shown below:</p>
  <pre><code>&gt;&gt;&gt; df.info()
  &lt;class 'pandas.core.frame.DataFrame'&gt;
  Int64Index: 117 entries, 0 to 116
  Columns: 176 entries, Mine to Index
  dtypes: datetime64[ns](2), float64(145), int64(26), object(3)
  memory usage: 161.8+ KB
  &gt;&gt;&gt; type(df['Start Date'][0])
  Out[6]: pandas.tslib.Timestamp
  &gt;&gt;&gt; type(df['End Date'][0])
  Out[7]: pandas.tslib.Timestamp
  </code></pre>
  <p><strong>Attempt/Approach 1:</strong></p>
  <pre><code>def read_as_dataframe(filename, ext):
     import pandas as pd
     if ext in ('xls', 'xlsx'):
        # problem: date columns auto converted to datetime.datetime or timestamp!
        df = pd.read_excel(filename) # unwanted - date columns converted!
  
     return df, name, ext
  </code></pre>
  <p><strong>Attempt/Approach 2:</strong></p>
  <pre><code>import pandas as pd
  # import datetime as datetime
  # parse_date = lambda x: datetime.strptime(x, '%Y%m%d %H')
  parse_date = lambda x: x
  elif ext in ('xls', 'xlsx', ):
      df = pd.read_excel(filename, parse_dates=False)
      date_cols = [df.columns.get_loc(c) for c in df.columns if c in ('Start Date', 'End Date')]
      # problem: date columns auto converted to datetime.datetime or timestamp!
      df = pd.read_excel(filename, parse_dates=date_cols, date_parser=parse_date)
  </code></pre>
  <p>And have also tried pyexcel library but it does the same auto-magic convert behavior:</p>
  <p><strong>Attempt/Approach 3:</strong></p>
  <pre><code>import pyexcel as pe
  import pyexcel.ext.xls
  import pyexcel.ext.xlsx
  
  t0 = time.time()
  if ext == 'xlsx':
      records = pe.get_records(file_name=filename)
      for record in records:
          print(&quot;start date = %s (type=%s), end date = %s (type=%s)&quot; %
                (record['Start Date'],
                 str(type(record['Start Date'])),
                 record['End Date'],
                 str(type(record['End Date'])))
                )
  </code></pre>