xlrd3读取Excel数据

引入xlrd3模块

import xlrd3
filePath = 'D:\PycharmProjects\Python\data.xlsx'
with xlrd3.open_workbook(filePath) as f:
    sheet = f.sheet_by_name('模块A')
    for i in range(sheet.nrows):
        print(sheet.row_values(i))

Excel数据:

输出结果如下:

['工号', '姓名', '性别', '籍贯', '出生日期', '入职日期', '月工资', '绩效系数', '年终奖金']
[535353.0, 'A', '', '哈尔滨', 28638.0, 37792.0, 4750.0, 0.5, 4275.0]
[626262.0, 'B', '', '成都', 30472.0, 37785.0, 2750.0, 0.95, 4702.5]
[727272.0, 'C', '', '杭州', 27174.0, 37786.0, 2750.0, 1.0, 4950.0]
[424242.0, 'D', '', '广州', 28253.0, 37783.0, 4750.0, 0.6, 5130.0]
[323232.0, 'E', '', '南京', 30659.0, 37782.0, 4250.0, 0.75, 5737.5]
[131313.0, 'F', '', '成都', 27642.0, 37789.0, 3250.0, 1.0, 5850.0]
[414141.0, 'G', '', '北京', 29221.0, 37776.0, 3750.0, 0.9, 6075.0]
[313131.0, 'H', '', '天津', 26284.0, 37775.0, 3250.0, 1.1, 6435.0]
[212121.0, 'I', '', '山东', 25839.0, 37774.0, 2750.0, 1.3, 6435.0]
[929292.0, 'G', '', '天津', 31683.0, 37788.0, 3750.0, 1.0, 6750.0]
[525252.0, 'K', '', '广州', 25335.0, 37784.0, 3250.0, 1.2, 7020.0]
[121212.0, 'L', '', '北京', 24231.0, 37773.0, 3250.0, 1.2, 7020.0]
[232323.0, 'M', '', '桂林', 32845.0, 37790.0, 3250.0, 1.3, 7605.0]
[919191.0, 'N', '', '南京', 28299.0, 37781.0, 3250.0, 1.3, 7605.0]
[828282.0, 'O', '', '成都', 24446.0, 37787.0, 3750.0, 1.2, 8100.0]
[616161.0, 'P', '', '厦门', 29516.0, 37778.0, 4750.0, 1.0, 8550.0]
[818181.0, 'Q', '', '广州', 32450.0, 37780.0, 3750.0, 1.3, 8775.0]
[434343.0, 'R', '', '西安', 24619.0, 37791.0, 3750.0, 1.3, 8775.0]
[717171.0, 'S', '', '上海', 24842.0, 37779.0, 4250.0, 1.2, 9180.0]
[515151.0, 'T', '', '上海', 21245.0, 37777.0, 4250.0, 1.5, 11475.0]

 


posted @ 2021-07-03 22:12  Avicii_2018  阅读(254)  评论(0编辑  收藏  举报