推荐学习书目
› Learn Python the Hard Way
Python Sites
› PyPI - Python Package Index
› http://diveintopython.org/toc/index.html
› Pocoo
值得关注的项目
› PyPy
› Celery
› Jinja2
› Read the Docs
› gevent
› pyenv
› virtualenv
› Stackless Python
› Beautiful Soup
› 结巴中文分词
› Green Unicorn
› Sentry
› Shovel
› Pyflakes
› pytest
Python 编程
› pep8 Checker
Styles
› PEP 8
› Google Python Style Guide
› Code Style from The Hitchhiker's Guide
sylvos
V2EX  ›  Python

请教:用 python 如何获取 excel 表的“保存”事件

  •  
  •   sylvos · Oct 15, 2016 via iPhone · 3902 views
    This topic created in 3635 days ago, the information mentioned may be changed or developed.
    如题,当 excel 表被保存时,把最新内容写入到数据库。但不知道怎样获取 excel 的保存事件,我现在的做法是隔两秒去open一次excel表,看表有没有关闭,感觉好傻的实现,请前辈指点迷津。
    5 replies  •  2016-10-16 22:55:32 +08:00
    tashimajia
        1
    tashimajia  
       Oct 15, 2016   ❤️ 1
    1. 用 VBA 通知 python 程序
    2. OS API 监听文件修改
    bingxx
        2
    bingxx  
       Oct 15, 2016   ❤️ 1
    定时监听文件 md5 是否改变。
    shinwood
        3
    shinwood  
       Oct 15, 2016 via iPhone
    @bingxx 这倒真是一个不错的方法,可以用在很多场合,文件不大的时候尤其适用。

    当然发散开来思维,可以记录下文件上次保存的时间,对比下当前的保存时间也行。
    momo1999
        4
    momo1999  
       Oct 15, 2016 via Android
    文件修改有监听通知的
    izoabr
        5
    izoabr  
       Oct 16, 2016
    可是 Excel 程序打开着文件的时候会不会独占呀?
    用内置的 VBA 来通知是最好。
    或者你干脆改这个 Excel 表,别写文件,直接写数据源
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   867 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 21:46 · PVG 05:46 · LAX 14:46 · JFK 17:46
    ♥ Do have faith in what you're doing.