import xlwings as xw
import os , time
app = xw.App(visible = True, add_book = False)
for i in range(3):
workbook = app.books.add()
workbook.save(f'C:\\Users\\Administrator\\Desktop\\test\\study\\test_sheet\\testsheet{i}.xlsx')
workbook.close() #批量新建工作簿
file_path = 'C:\\Users\\Administrator\\Desktop\\test\\study\\test_sheet'
file_list = os.listdir(file_path)
for i in file_list:
print(i) #读取文件夹下文件名称
if os.path.splitext(i)[1] == '.xlsx':
app.books.open(file_path + '\\' + i) #批量打开文件下的工作簿
print('打开工作簿:'+ i )
time.sleep(10)
app.quit()