- import re
- from openpyxl import load_workbook
- wb = load_workbook("批量提取图片根据货号单元格命名.xlsx")
- sht = wb.active
- for i in sht._images:
- with open(sht.cell(i.anchor._from.row + 1, 1).value + re.sub(r'.*\.', '.', i.path), 'wb') as f:
- f.write(i.ref.getvalue())
复制代码 用批处理解压后解析xml也行,就是有点麻烦 |