import xlwings as xw
app=xw.App(visible=True,add_book=False)
wb=app.books.add()
wb.sheets['sheet1'].range('A1:A10').value='人生'
wb.sheets['sheet1'].range(3,5).value='人生'
wb.sheets['sheet1'].range(3,6).formula = '=left(A1,1)'
wb.save(r'd:\test1.xlsx')
wb.close()
app.quit()
网友评论