使用xlwings读取excel中所有的值,写入mysql
#导入xlwings模块,打开Excel程序,默认设置:程序可见,只打开不新建工作薄,屏幕更新关闭
import xlwings as xw
app=xw.App(visible=True,add_book=False)
app.display_alerts=True
app.screen_updating=True
#文件位置:filepath,打开test文档,然后保存,关闭,结束程序
filepath=r'C:\Users\gsd\Desktop\test1.xlsx'
wb=app.books.open(filepath)
sht=wb.sheets['sheet1']
a=sht.range('A2').expand().value
wb.save()
wb.close()
app.quit()
数据库操作