Python Win32com Excel:将工作表复制到摘要文件后,工作表的数量会发生变化
我正在尝试使用win32com将文件夹中的所有xlsx文件合并到摘要文件中:Python Win32com Excel:将工作表复制到摘要文件后,工作表的数量会发生变化,python,excel,win32com,Python,Excel,Win32com,我正在尝试使用win32com将文件夹中的所有xlsx文件合并到摘要文件中: for file in range(len(segments[segment])): w = excel.Workbooks.Open(os.path.join(os.getcwd(), segments[segment][file]), ReadOnly=1) w.Sheets(1).Copy(After=wb.Worksheets(file + 1))
for file in range(len(segments[segment])):
w = excel.Workbooks.Open(os.path.join(os.getcwd(), segments[segment][file]), ReadOnly=1)
w.Sheets(1).Copy(After=wb.Worksheets(file + 1))
wb.ActiveSheet.Name = segments[segment][file]
w.Close(SaveChanges=True)
尽管两个文件中的打印和图纸设置完全相同,但复制的文件和摘要文件中的页数不同。这并不取决于我是否使用“ReadOnly=1”。
复制文件中的图纸:
并在摘要文件中:
为什么它们不同