安装方式可以直接安装,如果需要处理依赖直接使用pip处理即可。
import pyexcel url = './1.xlsx' def get_sheels(): sheet = pyexcel.get_sheet(file_name=url,name_columns_by_row=0) print(sheet.to_dict()) print(sheet[0]) # 删除的是第几行,或者可以将第一列名字作为索引进行删除操作 # print(sheet.delete_named_row_at(0)) # print(sheet.delete_named_row_at(20210801)) # print(sheet.delete_named_column_at(0)) # 按照行的索引进行删除操作,必须传入的是个表,索引不要求一定是按顺序 # print(sheet.delete_rows([0,3])) # print(sheet.delete_columns([1,2])) print(sheet.to_dict()) # sheet.save_as(url) def get_range(): sheet = pyexcel.get_sheet(file_name=url, name_columns_by_row=0) sheets = sheet.to_records() for i in sheets: print(i["姓名"]) print(i) def get_sheel(): sheet = pyexcel.get_book(file_name=url) print(sheet[0][0,1]) if __name__ == '__main__': # get_sheel() # get_sheels() get_range()
文件: