【Python】读取excel数据

'''python3读取excle数据'''
import xlrd
workbook = xlrd.open_workbook(r'test.xls', encoding_override='gbk')
print(workbook.sheet_names())

sheet = workbook.sheet_by_name('Sheet 1')
print(sheet.nrows, sheet.ncols)

for i in range(sheet.nrows):
    for j in range(sheet.ncols):
        print(sheet.cell(i, j).value, end=' ')
    print('\n')

猜你喜欢

转载自www.cnblogs.com/tiandsp/p/8905835.html