简体   繁体   English

通过Web服务将SQL Server迁移到Excel

[英]Sql Server to Excel via a Web Service

I would like to know the best way to transfer data from a web service to an excel worksheet (office 2007). 我想知道将数据从Web服务传输到Excel工作表的最佳方法(Office 2007)。 I am not interested in outputing a report to excel from a web site. 我对从网站输出excel报告不感兴趣。 In our scenario a user will be using excel (with a number of macros and such) and will request about 11000 rows of data from the server to a worksheet. 在我们的场景中,用户将使用excel(具有许多宏等),并将从服务器向工作表请求大约11000行数据。

Anyone have any experience with this? 有人对此有经验吗?

thanks in advance. 提前致谢。

A simple solution I've used in the past for getting data from a database to Excel via a web server is to simply expose the data as a table in a webpage. 我过去用于通过Web服务器将数据从数据库传输到Excel的简单解决方案是将数据简单地显示为网页中的表。 This can be done using any technology you like, eg ASP.NET, which can connect to the database, retreive the data and put the data in a GridView control. 这可以使用您喜欢的任何技术来完成,例如ASP.NET,它可以连接到数据库,检索数据并将数据放入GridView控件中。

You can then set up a 'Web Query' in Excel. 然后,您可以在Excel中设置“Web查询”。 This is done by using the menu item Data -> Import External Data -> New Web Query. 这是通过使用菜单项数据 - >导入外部数据 - >新建Web查询来完成的。 You can then navigate to your webpage, select the table as your data source, and choose the range to which it should be written. 然后,您可以导航到您的网页,选择该表作为您的数据源,并选择应该写入的范围。

There are options for auto-refresh, query string parameters (from cells in the worksheet), etc. 有自动刷新选项,查询字符串参数(来自工作表中的单元格)等。

You can automate the refreshment of your Web Query as part of a larger process by using VBA, eg 您可以使用VBA自动更新Web查询作为更大过程的一部分,例如

Sheet1.QueryTables(1).Refresh

Check into SharePoint and Excel Services - that's exactly what it's designed to do. 检查SharePoint和Excel Services - 这正是它的设计目标。 You can publish data sources in SharePoint for any users to use in Excel, and keep their Excel spreadsheets up to date with the data warehouse. 您可以在SharePoint中发布数据源,供在Excel中使用的任何用户使用,并使其Excel电子表格与数据仓库保持同步。

Architecture overview: 架构概述:

http://technet.microsoft.com/en-us/magazine/2009.02.bookbi.aspx http://technet.microsoft.com/en-us/magazine/2009.02.bookbi.aspx

Implementation guide in SQL Server Magazine (requires subscription): SQL Server Magazine中的实施指南(需要订阅):

http://www.sqlmag.com/Articles/Index.cfm?ArticleID=99355&pg=2 http://www.sqlmag.com/Articles/Index.cfm?ArticleID=99355&pg=2

You could use SQL SSIS to connect with the webservice task http://msdn.microsoft.com/en-us/library/ms140114.aspx 您可以使用SQL SSIS连接Web服务任务http://msdn.microsoft.com/en-us/library/ms140114.aspx

Then do the typical move to an excel destination. 然后进行典型的移动到excel目的地。

I've recently used a system which did something similar, essentially it was just an Excel Workbook with some VB script that would call the web service. 我最近使用了一个类似的系统,实际上它只是一个带有一些VB脚本的Excel工作簿,可以调用Web服务。 It also prompted the user for credentials. 它还提示用户输入凭据。

I can't post any code relating to the spreadsheet side of things, but there is plenty of examples and information out there such as this from Microsoft, and other tutorials / examples such as this . 我不能发布与事物的电子表格方面的任何代码,而且有大量的例子,在那里,如信息这个来自微软,和如其他教程/示例

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

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