Created
February 9, 2012 14:39
-
-
Save mingyc/1780383 to your computer and use it in GitHub Desktop.
A sample code that traverse and show the content of the given .xls file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from xlrd import * | |
wb = open_workbook('sample.xls') | |
for sheet in wb.sheets(): | |
print 'Sheet: {0}'.format(sheet.name) | |
for row in range(sheet.nrows): | |
row_value = [] | |
for col in range(sheet.ncols): | |
row_value.append(sheet.cell(row, col).value) | |
print ','.join(row_value) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment