简体   繁体   English

当 ZBF57C906FA7D2BB856D07372E4 打开时,如何自动更新 python output 文件的 excel 中的数据?

[英]How to auto update data in the excel of a python output file when the excel is open?

I write a code which scrapes data from web and save the data in excel.我编写了一个从 web 中抓取数据并将数据保存在 excel 中的代码。 Since the web data is continuously updated so I have to run the code continuously after 1-minute interval.All is working fine but when the excel file is open I got the following error message.由于 web 数据不断更新,因此我必须在 1 分钟间隔后连续运行代码。一切正常,但是当 excel 文件打开时,我收到以下错误消息。

Traceback (most recent call last):

PermissionError: [Errno 13] Permission denied: 'Option_Chain_Table_NIFTY.xlsx' PermissionError:[Errno 13] 权限被拒绝:'Option_Chain_Table_NIFTY.xlsx'

How can i solve this so that data is updated continuously even when it is open?我该如何解决这个问题,以便即使数据打开也能不断更新?

Python code Python代码

You can't.你不能。 A processor can not allow two different processes to write into the same file.一个处理器不能允许两个不同的进程写入同一个文件。 You can try and open the excel file in read only mode to do things simultaneously but it won't update in real time as your code progresses.您可以尝试以只读模式打开 excel 文件以同时执行操作,但它不会随着您的代码进行实时更新。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM