Skip to content

Instantly share code, notes, and snippets.

@mingyc
Created February 9, 2012 14:39
Show Gist options
  • Save mingyc/1780383 to your computer and use it in GitHub Desktop.
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
# -*- 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