采用python3解析sheet页一般采用xlrd进行excel解析,并进行文件读取的情况,但是对于一种特殊情况可能无法处理,如下: 对于xls的文件,可能存在没有sheet页的情况; 这个时候可能会采用以下的方式进行解析:
import xlrd
sheets
= xlrd
.open_workbook
(filepath
)
sheet
= sheets
.sheet_by_index
(0)
对于无sheet页的情况,直接读取的时候可能会出现读取的sheet页为空的情况,即读取的sheet页不是真正要展示的sheet页
这时候,可以读取其他的sheet页,真正的数据可能在其他的sheet页当中:
import xlrd
sheets
= xlrd
.open_workbook
(filepath
)
sheet
= sheets
.sheet_by_index
(1)
我采用这种方式,在第二个sheet页中找出了所需要解析的数据