示例代码如下:
fromopenpyxlimportWorkbookwb=Workbook()#grabtheactiveworksheetws=wb.active#Datacanbeassigneddirectlytocellsws['A1']=42#Rowscanalsobeappendedws.append([1,2,3])#Pythontypeswillautomaticallybeconvertedimportdatetimews['A2']=datetime.datetime.now()#Savethefilewb.save("sample.xlsx")点击空白处退出提示
评论