python读excel


1. 下载安装xlrd

点击打开链接


2. Demo

#!/usr/bin/python

import xlrd

data = xlrd.open_workbook("test.xlsx")

table = data.sheets()[0]

print table.nrows, table.ncols

for i in range(table.nrows):
        for j in range(table.ncols):
                value = table.cell(i, j).value
                if value:
                        print i, j, value
                else:
                        break
                          



你可能感兴趣的:(Python,python)