xlwings操作excel
2020-04-15 本文已影响0人
九章9405
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()