title: python pandas Access Excel MemoryError
body: <p>All,</p>
  
  <p>I've been trying to use pandas in python to load a table from access then write the data to an excel file see following code:</p>
  
  <p>When running it the code (python 3.5.2) I receive the following output:</p>
  
  <pre><code>&lt;!-- language: Python --&gt;
  
  import pandas as pd
  import pypyodbc
  
  conn = 'DSN=MyDSNTest'
  
  cnxn = pypyodbc.connect(conn)
  crsr = cnxn.cursor()
  qy = """select * from mytbl;"""
  df = pd.read_sql(qy, cnxn)
  
  cnxn.commit()
  crsr.close()
  cnxn.close()
  
  print ("read into dataframe")
  #writer = pd.ExcelWriter('c:/tmp/test.xlsx')
  #df.to_excel(writer, 'Data')
  
  df.to_excel('E:/Reports/AnalyticsInput/tblHistoryAC.xlsx', Data',index=False)
  
  # Close the Pandas Excel writer and output the Excel file.
  #writer.save()
  </code></pre>
  
  <hr>
  
  <blockquote>
    <p>read into dataframe   199966   Traceback (most recent call last):<br>
    File "C:\Users\jeff\test.py", line 23, in <br>
        df.to_excel('c:/tmp/MyTest.xlsx', 'Data', index=False)     File "C:\Python35-32\lib\site-packages\pandas\core\frame.py", line 1466, in
    to_excel<br>
        excel_writer.save()     File "C:\Python35-32\lib\site-packages\pandas\io\excel.py", line 790, in
    save<br>
        return self.book.save(self.path)     File "C:\Python35-32\lib\site-packages\openpyxl\workbook\workbook.py", line
    345, in save<br>
        save_workbook(self, filename)     File "C:\Python35-32\lib\site-packages\openpyxl\writer\excel.py", line 266,
    in save_workbook<br>
        writer.save(filename)     File "C:\Python35-32\lib\site-packages\openpyxl\writer\excel.py", line 248,
    in save<br>
        self.write_data()     File "C:\Python35-32\lib\site-packages\openpyxl\writer\excel.py", line 81,
    in write_data<br>
        self._write_worksheets()     File "C:\Python35-32\lib\site-packages\openpyxl\writer\excel.py", line 197,
    in _write_worksheets<br>
        xml = ws._write()     File "C:\Python35-32\lib\site-packages\openpyxl\worksheet\worksheet.py",
    line 870, in _write<br>
        return write_worksheet(self)     File "C:\Python35-32\lib\site-packages\openpyxl\writer\worksheet.py", line
    107, in write_worksheet<br>
        write_rows(xf, ws)   MemoryError</p>
  </blockquote>
  
  <p>While the file is 200,000 rows I'd have to believe there is something else or another way to produce the xlsx file without getting a memory error.  </p>
  
  <p>Any ideas?  Thanks!<br>
  Jeff</p>