0

我正在尝试将特定的命名范围读取到 python 中的数据框。我的 excel 文件是 xlsb 格式。

我试图在网上寻找它,似乎在 xlsx 格式上这样做是可能的,但没有找到任何适用于 xlsb 格式的东西。

4

1 回答 1

-1

您可以使用open_workbookfrompyxlsb来处理 xlsb 文件。

下面是一个示例代码:

from pyxlsb import open_workbook
with open_workbook('sample_data.xlsb') as wb:
    # Do stuff with wb
    # Using the sheet index (1-based)
    with wb.get_sheet(1) as sheet:
        for row in sheet.rows():
            print(row)

    # Using the sheet name
    with wb.get_sheet('Sheet1') as sheet:
        # Do stuff with sheet

参考:https ://pypi.org/project/pyxlsb/

于 2019-10-21T04:30:29.427 回答