我正在使用bitbucket存储库中的openpyxl 2.2.6。我尝试了documentation中的简单示例
但是,这会生成一个空白工作簿,其中有一个被恰当命名为“MyTestSheet”的工作表。但任何单元格中的值。在
我还缺什么能给手机写东西呢。在
from openpyxl import Workbook
wb = Workbook(optimized_write = True)
ws = wb.create_sheet(title="MyTestSheet")
from openpyxl.writer.dump_worksheet import WriteOnlyCell
from openpyxl.comments import Comment
from openpyxl.styles import Style, Font
cell = WriteOnlyCell(ws, value="hello world")
cell.font = Font(name='Courrier', size=36)
cell.comment = Comment(text="A comment", author="Author's Name")
wb.save("testwr_so.xlsx")
您需要将单元格附加到工作表:
ws.append([cell]) # you must always append a sequence
相关问题 更多 >
编程相关推荐