import win32com.client as win32
# 能把所有图片按原图象素导出来
excel = win32.gencache.EnsureDispatch('Excel.Application')
excel.Visible = False # 可视化
excel.DisplayAlerts = False # 是否显示警告
workbook = excel.Workbooks.Open(r'C:\Users\Thinkpad\Desktop\金溪水库资料整编2023110--V6.xlsx')
file_names = [] #把图表名称存入列表
for sheet in workbook.Worksheets:
if sheet.Name == '水平位移':
for i, shape in enumerate(sheet.Shapes):
#print(sheet.Name, shape.Name)
file_names.append(shape.Name)
print(file_names)
excel.Quit()