[英]Python win32com on Microsoft Excel WorksheetFunction
Is there any way to call an Excel WorksheetFunction
in Python win32com
or any other libraries? 有什么方法可以在Python win32com
或任何其他库中调用Excel WorksheetFunction
吗?
I would like to use formulas like VLookup
/ Match
/ Index
/ SumIfs
in Python. 我想用公式像VLookup
/ Match
/ Index
/ SumIfs
Python编写的。
Yes. 是。 You can use the WorksheetFunction
object on the Application
object. 您可以在Application
对象上使用WorksheetFunction
对象。 For instance, in the particular case of Match
, to find the first occurrence of 1.0
in 'B:B'
in the first sheet of the first open workbook, you can do 例如,在Match
的特定情况下,要在第一个打开的工作簿的第一页的'B:B'
中找到1.0
的第一个匹配项,您可以
import win32com.client
excel = win32com.client.Dispatch('Excel.Application')
workbook = excel.Workbooks(1)
worksheet = workbook.Worksheets(1)
excel.WorksheetFunction.Match(1.0, worksheet.Range('B:B'), 0)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.