[英]Working with multiple excel workbooks in python
Using win32com, I have two workbooks open. 使用win32com,我打开了两个工作簿。
What is your larger goal here? 你在这里的目标是什么? Automate already open excel windows or simply write XLS files?
自动打开excel窗口或只是编写XLS文件? If it's the latter you should use consider using xlwt .
如果是后者,你应该考虑使用xlwt 。
How do you know which one is active?
你怎么知道哪一个是活跃的?
xl = win32com.client.Dispatch("Excel.Application")
wbOne = xl.Workbooks.Add()
wbTwo = xl.Workbooks.Add()
xl.ActiveWorkbook == wbOne
False
xl.ActiveWorkbook == wbTwo
True
How do you change which one is active?
你如何改变哪一个是活跃的?
wbOne.Activate()
xl.ActiveWorkbook == wbOne
True
How can you close one and not the other?
你怎么能关闭一个而不是另一个? (not Application.Quit())
(不是Application.Quit())
wbOne.Close()
wbTwo.Close()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.