【问题标题】:How to read a specific named range from an xlsb excel file using python?如何使用 python 从 xlsb excel 文件中读取特定的命名范围?
【发布时间】:2019-10-21 03:46:30
【问题描述】:

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

我尝试在网上查找它,似乎可以在 xlsx 格式上执行此操作,但没有找到任何 xlsb 格式的内容。

【问题讨论】:

    标签: python dataframe named-ranges xlsb


    【解决方案1】:

    您可以使用pyxlsb 中的open_workbook 来处理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/

    【讨论】:

      猜你喜欢
      • 2015-06-22
      • 1970-01-01
      • 2012-06-24
      • 2021-04-11
      • 1970-01-01
      • 2022-12-04
      • 2021-08-22
      • 2017-12-14
      • 1970-01-01
      相关资源
      最近更新 更多