31 Replies - 3189 Views - Last Post: 10 July 2012 - 10:29 PM
#1
xlrd Excel in python
Posted 18 May 2012 - 03:17 PM
My goal is to read each column of the spreadsheet and save it in a vector. It's possible?
Replies To: xlrd Excel in python
#2
Re: xlrd Excel in python
Posted 18 May 2012 - 04:06 PM
The most promising answers on that first Google page (to my non-Python developer eyes) are:
- Read Excel files from Python
- Working with Excel files in Python (PDF)
If you've already tried some of those methods and failed to make it work, say so. Show us what didn't work, and perhaps we may be able to help you fix it.
#3
Re: xlrd Excel in python
Posted 18 May 2012 - 04:21 PM
#4
Re: xlrd Excel in python
Posted 18 May 2012 - 04:32 PM
Atli, on 18 May 2012 - 04:06 PM, said:
The most promising answers on that first Google page (to my non-Python developer eyes) are:
- Read Excel files from Python
- Working with Excel files in Python (PDF)
If you've already tried some of those methods and failed to make it work, say so. Show us what didn't work, and perhaps we may be able to help you fix it.
I've searched on the internet but do not have the module xlrd for windows and trying to open direct with open() does not work
#6
Re: xlrd Excel in python
Posted 18 May 2012 - 04:55 PM
atraub, on 18 May 2012 - 04:36 PM, said:
I'm sorry, I'm sleeping.
I found xlrd1 for windows
I tried a program to print the cell A1
import xlrd1
wb = xlrd1.open_workbook('file.xls')
sh = wb.sheet_by_index(0)
print sh.cell(0,0).value
Output:
Traceback (most recent call last):
File "file.py", line 3, in <module>
wb = xlrd1.open_workbook('file.xls')
File "C:\Python27\xlrd1\__init__.py", line 431, in open_workbook
on_demand=on_demand,
File "C:\Python27\xlrd1\__init__.py", line 899, in biff2_8_load
f = open(filename, open_mode)
IOError: [Errno 22] invalid mode ('rb') or filename: 'file.xls'
What am I doing wrong?
#7
Re: xlrd Excel in python
Posted 18 May 2012 - 05:00 PM
#8
Re: xlrd Excel in python
Posted 18 May 2012 - 05:13 PM
atraub, on 18 May 2012 - 05:00 PM, said:
Yes. I've also tried specifying the path
I used \\ and work. But now gave the following error
raise XLRDError('Unsupported format, or corrupt file: ' + msg)
XLRDError: Unsupported format, or corrupt file: Expected BOF record; found 'ABCD\t'
#9
Re: xlrd Excel in python
Posted 18 May 2012 - 05:18 PM
#10
Re: xlrd Excel in python
Posted 18 May 2012 - 05:32 PM
#11
Re: xlrd Excel in python
Posted 18 May 2012 - 05:54 PM
#12
Re: xlrd Excel in python
Posted 18 May 2012 - 07:23 PM
#13
Re: xlrd Excel in python
Posted 18 May 2012 - 07:45 PM
#14
Re: xlrd Excel in python
Posted 18 May 2012 - 08:12 PM
#15
|
|

New Topic/Question
Reply



MultiQuote








|