Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python : issue running XLRD

Tags:

python

xlrd

I'm testing newly installed 'xlrd' package :

#!/usr/bin/env/python

import xlrd

wb = xlrd.open_workbook('D:\excel\test.xls')

print (wb.sheets())

I run it through IDLE (Windows 7) and I get the following error message:

Python 3.3.3 (v3.3.3:c3896275c0f6, Nov 18 2013, 21:19:30) [MSC v.1600 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> ================================ RESTART ================================
>>> 
Traceback (most recent call last):
  File "D:\excel\testxls.py", line 3, in <module>
    import xlrd
  File "C:\Program Files (x86)\Python33\lib\site-packages\xlrd\__init__.py", line 1187
    print "EXTERNSHEET(b7-):"
                        ^
SyntaxError: invalid syntax
>>> 

Any idea on this issue?

Thanks!

like image 408
wiltomap Avatar asked Jan 23 '15 09:01

wiltomap


People also ask

What is xlrd module in Python?

xlrd is a module that allows Python to read data from Excel files.


1 Answers

It seems like your xlrd file is corrupted. So update it by using the following command :

$ python3 -m pip install --upgrade xlrd
like image 83
Raj725 Avatar answered Jan 03 '23 14:01

Raj725