Reading Excel using xlrd package in python
Ananthashayana V
ananthashayana at gmail.com
Mon Feb 26 12:50:46 EST 2007
Hi John,
With reference to your reply to kath
http://mail.python.org/pipermail/python-list/2006-October/407157.html
I have a small query, my code is as follows
#------- Reading excel----------------------------------
import xlrd
book = xlrd.open_workbook("E:/test.xls")
print "The number of worksheets is", book.nsheets
print "Worksheet name(s):", book.sheet_names()
sh = book.sheet_by_index(0)
for rx in range(sh.nrows):
# print sh.row(rx)
val = sh.row(rx)
print val
#-------------------------------------------------------------
Now the results are as follows
[text:u'test1\xa0', text:u'text1', xldate:39066.0, number:1234.1]
[text:u'test2', text:u'text2', xldate:39066.0, number:1234.2]
[text:u'test3\xe9', text:u'text3', xldate:39066.0, number:1234.3]
[text:u'test4\xe9', text:u'text4', xldate:39066.0, number:1234.4]
---------------------------------------------------------------------------------------------
Now as you can clearly observe, I want to:
1. Remove the additional tags like text, xldate, number.
2. Display date in normal form like dd-mm-yyyy, or dd/mm/yyyy or may be
yyyy-mm-dd .
3. Finally would like remove the spaces and some UNICODE characters, here
its being represented as \xe9 or \xa0
Can you please help me out on this. I would really appreciate it.
Thanks in advance.
Cheers
shayana
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20070226/d2fa6843/attachment.html>
More information about the Python-list
mailing list