已安装xlwings和pandas
Python报错如下:
Traceback (most recent call last):
File "C:\Users\jing.he\Desktop\【应收】一个表拆开几个工作簿.py", line 1, in
import xlwings as xw
File "C:\Users\jing.he\AppData\Local\Programs\Python\Python39\lib\site-packages\xlwings\__init__.py", line 9, in
from . import _xlwindows as xlplatform
File "C:\Users\jing.he\AppData\Local\Programs\Python\Python39\lib\site-packages\xlwings\_xlwindows.py", line 14, in
import pywintypes
ModuleNotFoundError: No module named 'pywintypes'
代码如下:
import xlwings as xw
import pandas as pd
app = 域名正在出售中 Domain For Sale(visible = True,add_book =False)
workbook = app.books.open('C:\\Users\\jing.he\\Desktop\\789.xlsx')
worksheet =workbook.sheets['邮寄业务']
value = worksheet.range('A1').options(pd.DataFrame,header = 1,index = False,expand = 'table').value
data = value.groupby('借出门店')
for idx,group in data:
new_worksheet = workbook.sheets.add(idx)
new_worksheet['A1'].options(index = False).value = group
workbook.save()
workbook.close()
qpp.quit()