import os
from openpyxl import load_workbook
path=r"C:\git"
select = input("select:")
def del_file(path):
ls = os.listdir(path)
for i in ls:
c_path = os.path.join(path, i)
if os.path.isdir(c_path):
del_file(c_path)
elif os.path.splitext(c_path)[1] == '.xlsx' and r"~$" not in r''+c_path:
workbook = load_workbook(c_path)
worksheets = workbook.sheetnames
for sheet in worksheets:
count = 0
worksheet1 = workbook[u''+sheet]
num_rows = worksheet1.max_row
num_cols = worksheet1.max_column
for rown in range(num_rows):
for coln in range(num_cols):
cell = worksheet1.cell(rown+1,coln+1).comment
if cell is not None
Python查找目录下EXCEL文件包含指定内容的批注位置
最新推荐文章于 2023-09-17 09:25:46 发布