[英]How to read a specific named range from an xlsb excel file using python?
我正在嘗試將特定命名范圍讀取到 python 中的 dataframe。 我的 excel 文件是 xlsb 格式。
我試圖在網上尋找它,似乎在 xlsx 格式上這樣做是可能的,但沒有找到任何適用於 xlsb 格式的東西。
您可以使用open_workbook
中的pyxlsb
來處理 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
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.