Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python library for handling Excel files (xls | xlsx) [closed]

Tags:

python

excel

I need a python library that could read and write Excel files with all formats (i.e xls and xlsx).

I'm new to python and I was using Java before. In Java I was using POI library and it was perfect. I need a python library with the same functionality if possible.

like image 625
Islam Hassan Avatar asked Aug 01 '12 04:08

Islam Hassan


People also ask

Can openpyxl read xls?

We can read data from xls or xlsx files using python programming and we can also write to xls or xlsx files using python programming. We do this by using the python package "openpyxl". The package "openpyxl" can be found in Python Package Index.

Can Python open xls files?

You can easily import an Excel file into Python using Pandas. In order to accomplish this goal, you'll need to use read_excel.

What is the most popular library to handle Excel documents in Python?

PyXLL is a professional library that can handle almost everything a user wants in Excel with Python.

How read data from xls file in Python?

Reading an Excel FileThe read_excel function of the pandas library is used read the content of an Excel file into the python environment as a pandas DataFrame. The function can read the files from the OS by using proper path to the file. By default, the function will read Sheet1.


2 Answers

I know this thread hasn't been active in a while, but I thought it would be nice to add an answer here since I made a new solution to this problem.

I had this same issue so I went ahead and created a small library that includes python-excel (xlrd, xlwt) and openpyxl within it. You can find it here: https://github.com/camyoung1234/spreadsheet

Then to use it you type the exact same code as openpyxl, except you replace openpyxl with spreadsheet. When you load and save files it looks at the extension and determines which library to use for handling it.

To install it just download it, extract it, rename the folder spreadsheet-master to spreadsheet and place it in PythonXX/Lib/site-packages/ (I've only tested with Python 2.7 but it should work with others)

The README has a few examples to help you get started.

like image 93
camyoung1234 Avatar answered Nov 15 '22 04:11

camyoung1234


Python excel looks like a go: http://www.python-excel.org/

Also OpenPyXl may have the features you need: http://packages.python.org/openpyxl/

like image 20
Rory Hart Avatar answered Nov 15 '22 04:11

Rory Hart