Excel_Parser_openpyxl.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:PyQYT 作者: collinsctk 项目源码 文件源码
def excel_parser(file = 'test.xlsx', sheel_name = 'Sheet1'):
    data = load_workbook(file)
    table = data[sheel_name]
    print('%-22s %-22s %s' % (table['A1'].value, table['B1'].value, table['C1'].value))
    #print(table.rows)
    row_location = 0 
    for row in table.iter_rows():
        if row_location == 0:
            row_location += 1
            continue
        else:
            cell_location = 0
            for cell in row:
                if cell_location == 0:
                    print('??:%-20s' % cell.value, end='')
                    cell_location += 1
                elif cell_location == 1:
                    print('??:%-20s' % cell.value, end='')
                    cell_location += 1
                elif cell_location == 2:
                    print('??:%-20s' % cell.value, end='')
                    cell_location += 1
            print()
        row_location += 1
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号