xls (Excel file) to 2D array in Python?

Posted on 2011-05-08
Last Modified: 2012-06-27
how can I read/import an xls file to a 2D array in Python?

In case of formulas, do it read the raw text of the formula or its resulting value?
Question by:lucavilla
    LVL 28

    Accepted Solution

    My personal experience is that you need MS Excel installed on the machine, and that you should use the Excel components to work with the .xls files reliably.  However, you can find some alternative tools like the ones at  The Download links point to PyPI repository.  You can find there the 56 pages PDF tutorial with "Working with Excel files in Python" by Chris Withers with help from John Machin that was presented at EuroPython 2009 in Birmingham.

    I know nothing about the quality of the tools; however, it could be (at least) the good point to start from.

    LVL 6

    Assisted Solution

    There are existing packages you can reuse.
    Simplest would be if you can "Save as.." the excel as a csv file then you can use the built-in csv handler package:
    Else use: (documentation available here:
    LVL 31

    Expert Comment

    by:James Murrell
    This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Less strange, but still introduction This introduction was added (1st August, 2011) to reflect some reactions.  Firstly, the term basics in the title of the article...  As any other word, it is a symbol with meaning attached to the word by some a…
    This article will show the steps for installing Python on Ubuntu Operating System. I have created a virtual machine with Ubuntu Operating system 8.10 and this installing process also works with upgraded version of Ubuntu OS. For installing Py…
    Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
    Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now