Is there any way to call an Excel WorksheetFunction
in Python win32com
or any other libraries?
I would like to use formulas like VLookup
/ Match
/ Index
/ SumIfs
in Python.
Yes. You can use the WorksheetFunction
object on the Application
object. 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
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)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.