[英]How to create a pivot table in Excel with python win32com
[英]best python module to update huge excel which has pivot table (with openpyxl, win32com and Pyexcelerate facing different issues)
我嘗試過的模塊:
openpyxl
- 我能夠更新工作表,但問題是它正在刪除工作表中現有的 pivot 表
win32com
- 得到:
pywintypes.com_error: (-2147352567, '發生異常。', (0, None, None, None, 0, -2147352565), None)
使用以下代碼時:
from win32com.client import Dispatch
xl = Dispatch("Excel.Application")
xl.Interactive = True
#xl.Visible = True
wb=xl.Workbooks.Item("Inforce_Fire_Validation.xlsx")
ws=wb.Sheets("BV Cube")
print(ws.Range('A5'))
ws.Range('A5').Value=55
我通常使用 pandas 讀取 excel來加載 excel 表作為 Z3A43B4F88325D94022C0EFA9 框架。 然后我使用 python 來編輯數據框。 然后使用 pandas to_excel() 方法編寫一個新的 excel 文件。 也許這有幫助
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.