Created
August 31, 2015 11:16
-
-
Save enjoyksoo/aa496c0c5f11ed60ac49 to your computer and use it in GitHub Desktop.
python_xlrd_3
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
__author__ = 'Administrator' | |
import xlrd | |
wb = xlrd.open_workbook("C:\\test.xlsx") | |
ws = wb.sheet_by_index(0) | |
ncol = ws.ncols | |
nlow = ws.nrows | |
print "-------- Sheet1 --------" | |
print "Number of col: " + str(ncol) | |
print "Number of low: " + str(nlow) | |
print "-------- Values of Excel file --------" | |
i = 0 | |
j = 0 | |
low = [] | |
list = [] | |
while i < nlow : | |
while j < ncol : | |
low.append(str(ws.row_values(i)[j])) | |
j += 1 | |
list.append(low) | |
low = [] | |
i += 1 | |
j = 0 | |
i = 0 | |
while i < 4 : | |
print list[i] | |
i += 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment