vba 将实时数据推送或提供到 Excel 电子表格
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4676883/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Pushing or serving real-time data to an excel spreadsheet
提问by Monolithguy
I am running some test automation on a networked computer resource (remote). The remote computer running the test automation generates some output, which I can customize however I wish - probably a text or excel file.
我正在网络计算机资源(远程)上运行一些测试自动化。运行测试自动化的远程计算机会生成一些输出,我可以根据需要对其进行自定义 - 可能是文本或 Excel 文件。
I would like to create an excel spreadsheet which, from my local machine, monitors this output and provides real-time analytics. Later I would make the networked computer visible to more people, and they can use the same spreadsheet to monitor this output.
我想创建一个 excel 电子表格,它从我的本地机器上监视此输出并提供实时分析。后来我会让更多人看到联网计算机,他们可以使用相同的电子表格来监控这个输出。
My problem is that this networked computer is located on the other side of the earth, and so using any kind of polling in excel VBA to PULL the data from the networked computer results in a very long wait with the pinwheel spinning, making the sheet clumsy and less useful. The same thing happens when I use excel's built in function for linking to "external resources"
我的问题是这台联网计算机位于地球的另一端,因此在 excel VBA 中使用任何类型的轮询从联网计算机中提取数据会导致风车旋转的等待时间很长,使工作表变得笨拙而且用处不大。当我使用 excel 的内置函数链接到“外部资源”时,也会发生同样的事情
Is there any way to PUSH data to the excel spreadsheet from the networked computer? Something that is easy to set up would be ideal, the latency does not have to be low, so long as there is no awkward "busy wait" while the sheet updates. If that is not possible, is there any way of using PULL from the excel sheet that avoids the same busy wait?
有什么办法可以将数据从联网的计算机上推送到excel电子表格中吗?易于设置的东西将是理想的,延迟不必很低,只要在工作表更新时没有尴尬的“忙等待”。如果这是不可能的,有没有办法从 Excel 工作表中使用 PULL 来避免同样的忙碌等待?
回答by Gaven
You can write a Real-Time Data server
您可以编写实时数据服务器
There's a lot of resources on this , but here is a good start
有很多关于这个的资源,但这是一个好的开始
http://www.add-in-express.com/add-in-net/excel-rtd-servers.php
http://www.add-in-express.com/add-in-net/excel-rtd-servers.php
回答by Kevin Ross
Due to the long delays stopping the excel process I can think of 2 possibilities assuming you are sticking with excel
由于停止 excel 过程的长时间延迟,假设您坚持使用 excel,我可以想到 2 种可能性
- Pull the data to a local data source (Access, SQLite, SQL Server) and then query that
- Run the update query asynchronously so its not having the wait to get the data
- 将数据拉取到本地数据源(Access、SQLite、SQL Server),然后查询
- 异步运行更新查询,因此无需等待获取数据
Personally I would go for option 1
我个人会选择选项 1