Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

parsing excel documents with python [closed]

I want to parse excel document to lists in Python. Is there a python library which is helpful for this action? And what functions are relevant in that library?

like image 929
tomermes Avatar asked Sep 10 '11 15:09

tomermes


People also ask

Do you read Excel files with Python there is a 1000x faster way?

Importing csv files in Python is 100x faster than Excel files. We can now load these files in 0.63 seconds. That's nearly 10 times faster! Python loads CSV files 100 times faster than Excel files.

Can Python read an open Excel file?

You can easily import an Excel file into Python using Pandas. In order to accomplish this goal, you'll need to use read_excel. In this short guide, you'll see the steps to import an Excel file into Python using a simple example.

Can Python extract data from Excel?

Further Reading. There's a lot more you can do with Excel files in your Python programs. For example, you can modify data in an existing Excel file, or you can extract the data you're interested in and generate an entirely new Excel file.


1 Answers

You're best bet for parsing Excel files would be the xlrd library. The python-excel.org site has links and examples for xlrd and related python excel libraries, including a pdf document that has some good examples of using xlrd. Of course, there are also lots of related xlrd questions on StackOverflow that might be of use.

One caveat with the xlrd library is that it will only work with xls (Excel 2003 and earlier versions of excel) file formats and not the more recent xlsx file format. There is a newer library openpyxl for dealing with the xlsx, but I have never used it.

UPDATE: As per John's comment, the xlrd library now supports both xls and xlsx file formats.

Hope that helps.

like image 73
Mark Gemmill Avatar answered Sep 20 '22 04:09

Mark Gemmill