如何使用xlwings库读取一系列行并在python中放入dataframe?

2024-04-19 10:16:54 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个xlsb格式的巨大excel数据,由于它的大小,我想通过xlsb库一次只读取一些行。你知道吗

我已经在这里写了我的代码,请检查。你知道吗

import pandas as pd
import xlwings as xw
app = xw.App()
book = xw.Book(some_excel.xlsb)
sheet = book.sheets('Sheet1') 
#from sheet1, I want to store 1150 rows into dataframe 
#but I don't know how to read that much rows and put it in a dataframe simultaneously 
df= sheet.range('A1').options(pd.DataFrame, expand='table').value # here I stored all rows the into df but after putting into dataframe will not give the required output.
book.close()
app.kill()

Tags: toimportappdataframedfasexcelsheet