Pthon 将Excel读入List中

Pthon 将Excel读入List中


    # 读取并处理
    def readFromExcel(file_path):
        wb = openpyxl.load_workbook(file_path)
        sheet_list = wb.sheetnames
        ws = wb[sheet_list[0]]
        total_list = []
        for row in ws.rows:
            row_list = []
            for cell in row:
                row_list.append(cell.value)
            total_list.append(row_list)
        # total_list = total_list[17:]

        # 倒序输出
        # total_list.reverse()
        if checkModifyTime(): return
        return total_list
posted @ 2020-11-12 09:48  c_b  阅读(224)  评论(0)    收藏  举报