0

I am trying to import an Excel (.xlsx) file into the Spyder IDE. Everything works fine when I import small files, using openpyxl, but for this particular file (around 30MB and 800k rows) my system crashes.

Following is the part of code that imports:

from openpyxl import load_workbook 
wb = load_workbook(filename=path + 'cleaned_noTC_s_PERNO_Date.xlsx', data_only=True)

Can anyone please let me know what is wrong with this method and what else can I use to import the stated file?

1
  • any way you can share the excel file? Commented Apr 14, 2015 at 3:42

2 Answers 2

1

Try using the excellent pandas library, it has very robust excel reading functionality and is pretty good with memory in my experience:

See here:

import pandas as pd
xl = pd.read_excel("file.xlsx")
Sign up to request clarification or add additional context in comments.

Comments

0

It sounds like you're running out of memory. If you don't need to edit the file then you can use read_only mode, otherwise you'll need more memory.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.