【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')

 

转载于:https://www.cnblogs.com/tiandsp/p/8905835.html

你可能感兴趣的:(【Python】读取excel数据)