Tag: pyexcel

Pyexcel更改单元格值

所以我在所有的Excel项目中都使用了openpyxl ,但现在我必须使用.xls文件,所以我不得不改变库。 我select了pyexcel cuz,它似乎相当简单,并有很好的文档。 所以我经历了创build数百个variables,因为没有.index属性,或者什么东西。 我现在想要做的是读正确的文件中的列,在“数量”列中,并从中获得fe值12 ,然后检查其他文件中的同一列,如果不是12,则将其设置为12 。 简单。 但是我找不到有关在文档中更改单个单元格值的任何字词。 你可以帮我吗?

用烧瓶返回一个创build好的excel文件

我正在使用openpyxl创build一个excel文件,我希望将其作为文件下载返回(因此不在本地保存)。 我可以创build好的Excel文件并将其保存到磁盘。 但是,我不能得到这个文件下载。 尝试1: import flask_excel as excel … create_excel_sheet(data) # internally save the sheet with name sheet.xlsx output = excel.make_response() output.headers["Content-Disposition"] = "attachment; filename=" + \ 'sheet.xlsx' output.headers["Content-type"] = "application/vnd.openxmlformats-\ officedocument.spreadsheetml.sheet" return output 这将返回一个名为sheet.xlsx的空文本文件 尝试2:wb = create_excel_sheet(data)#返回openpyxl工作簿 output = excel.make_response(wb) output.headers["Content-Disposition"] = "attachment; filename=" + \ 'sheet.xlsx' output.headers["Content-type"] = "application/vnd.openxmlformats-\ officedocument.spreadsheetml.sheet" return output 我不想使用pyexcel作为数据,因为我需要使用openpyxl来创build一个奇特的excel表单。 […]

python中的Pyexcel中迭代表单

我想遍历Excel的所有非空表,以获得标题。 我必须使用PyExcel。以下是我的代码: import pyexcel as pe book = pe.get_book(file_name="Mydata.xlsx") j=0 print(j) for j in range(100): for item in book.sheet_by_index(j): sheet = pe.get_sheet(file_name="Mydata.xlsx") sheetheaders= sheet.row_at(0) header_list = [i for i in sheetheaders if i != '' ] print(header_list) j=j+1 任何人都可以告诉我如何迭代它,而不会出现以下错误? Traceback (most recent call last): line 11, in <module> for sheet in book[i]: TypeError: 'NoneType' object […]

如何从.xlsx文件的内容获取字典?

我正在尝试使用pyexcel但按照说明进行操作时遇到问题。 在文档上 ,它说运行这个代码: >>> import pyexcel >>> import json >>> book_dict = pyexcel.get_book_dict(file_name="book.xls") >>> isinstance(book_dict, OrderedDict) True >>> for key, item in book_dict.items(): … print(json.dumps({key: item})) {"Sheet 1": [[1, 2, 3], [4, 5, 6], [7, 8, 9]]} {"Sheet 2": [["X", "Y", "Z"], [1, 2, 3], [4, 5, 6]]} {"Sheet 3": [["O", "P", "Q"], [3, 2, […]