Xlwings从定义的名称中获取价值

问题描述:

我有一个定义名称的excel,单元格A1分配了名称"myName",是否可以使用xlwings从其名称而不是其坐标中获取其内容?

I have an excel with a defined name, cell A1 has assigned name "myName" is there a way with xlwings to take its content from its name rather than on its coordinates?

应该与

    title, coord = next(wb.defined_names['myName'].destinations)
content = wb[title][coord].value

在openpyxls

in openpyxls

可以,只需:

import xlwings as xw
xw.sheets[0].range('myName').value

另请参见: http://docs.xlwings.org/en/stable/api.html#name