[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

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

Posted on 2011-05-08
4
Medium Priority
?
584 Views
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?
0
Comment
Question by:lucavilla
3 Comments
 
LVL 29

Accepted Solution

by:
pepr earned 1000 total points
ID: 35718611
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 http://www.python-excel.org/.  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.

0
 
LVL 6

Assisted Solution

by:theKashyap
theKashyap earned 1000 total points
ID: 35718613
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: http://docs.python.org/library/csv.html
Else use: http://pypi.python.org/pypi/xlrd (documentation available here: http://www.python-excel.org/)
0
 
LVL 31

Expert Comment

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

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A set of related code is known to be a Module, it helps us to organize our code logically which is much easier for us to understand and use it. Module is an object with arbitrarily named attributes which can be used in binding and referencing. …
Here I am using Python IDLE(GUI) to write a simple program and save it, so that we can just execute it in future. Because when we write any program and exit from Python then program that we have written will be lost. So for not losing our program we…
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
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…
Suggested Courses

834 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