Let xlwings run background

2019-02-22  本文已影响0人  曹帅军
# -*- coding: utf-8 -*-
import xlwings as xw
import datetime

# app = xw.apps.add()
# app.visible = False  # Can't work well. Excel app will flash once, and then disappear.
app = xw.App(visible=False)

wb = app.books.open('catalog.xlsx')
sht = wb.sheets['Sheet1']
rg = sht.range('A1:B8')

time = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
sht.range('A20').value = time

wb.save()
app.kill()

Ref:
https://stackoverflow.com/questions/49006324/why-app-visible-false-can-not-make-the-excel-app-run-backguound-but-app

上一篇下一篇

猜你喜欢

热点阅读