import xlwings as xw
xlapp = xw.App(visible=True, add_book=False)
a = xlapp.api.GetOpenFilename('Excel Files (*.xl*),*.xl*', 0, 0, 0, True)
print(a[0])
slist = []
for i in a:wk = xw.Book(i)for s in wk.sheets:s_dict = {}s_dict['工作簿名字'] = wk.names_dict['工作表名字'] = s.nameslist.append(s_dict)wk.close()slist2 = []
for i in a:wk = xw.Book(i)slist2 += [{'工作簿名字': i.name, '工作表名字': s.name} for s in wk.sheets]