其他分享
首页 > 其他分享> > 使用openpyxl 记录

使用openpyxl 记录

作者:互联网

 

遍历得到某列中断的行数(位置)

import openpyxl

from openpyxl import Workbook

file_name = 'wb.xlsx'
wb1 = openpyxl.load_workbook(file_name)

sheets = wb1.sheetnames

li_to_func2 = []
for sheet in sheets:

    ws1 = wb1[sheet]
    li_count = []
    for i in range(1, ws1.max_row+2):

        code = ws1.cell(row=i, column=1).value

        if not code and len(li_count) < 1:
            li_count.append(i-1)
            # 找到第一列中断的行数
            print(li_count, sheet)

 

标签:count,sheet,openpyxl,记录,wb1,li,ws1,使用
来源: https://www.cnblogs.com/Bluemomo/p/14357069.html