import win32com.client
import time
path = r'absolute dir' #比如填文件的绝对路径,比如d:/file/stock.xlsx
xl = win32com.client.DispatchEx("Excel.Application")
workbook = xl.Workbooks.Open(path)
xl.Visible = False 
workbook.RefreshAll()
workbook.Save()
# time.sleep(3) #如果文件足够大,那么最好是在关闭excel之前保持几秒钟
workbook.Close(True)
xl.Quit()

from: https://blog.csdn.net/chang1976272446/article/details/80668034

相关文章:

  • 2022-12-23
  • 2021-11-25
  • 2021-06-05
  • 2021-12-22
  • 2021-08-02
  • 2021-09-07
  • 2022-12-23
猜你喜欢
  • 2021-12-25
  • 2021-04-19
  • 2021-11-27
  • 2022-12-23
  • 2021-05-23
  • 2022-02-07
相关资源
相似解决方案