如何每天将数据从数据库中提取到Excel中并将excel放入指定位置? [英] How to pull out the data from Database into an excel on daily basis and place the excel into a specified location?

查看:159
本文介绍了如何每天将数据从数据库中提取到Excel中并将excel放入指定位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我有一个要求,我需要每天准备一份报告。我需要查询数据库(SQL Server 2008)以提取数据并将数据导出到excel并将其发送到客户端。

我想自动化它,即数据应该导出自动excel,文件应放在特定的位置。

请帮助如何实现此功能。我正在使用SQL Server 2008.



TIA。

Hi Guys,

I have a requirement where I need to prepare a report everyday. I need to query the database(SQL Server 2008) to pull out the data and export data to an excel and send the same to the client.
I want to automate it i.e., the data should be exported to excel automatically and the file should be placed in a specific location.
Please help how to implement this functionality. I am using SQL server 2008.

TIA.

推荐答案

你有两个很大的选择:



1.每次都要创建目标Excel工作簿。

2.更新现有Excel工作簿中的数据。



如果你想创建工作簿,请看这篇文章:

http://www.excel-sql-server.com/sql-server-export-to-excel.htm [ ^ ]



第二种方法是基于使用执行以下操作的脚本:



1.打开工作簿。

2.更新已连接的表格。

3.关闭工作簿。



这是一个很好的解决方案,因为您可以为您的客户自定义工作簿。

您可以找到完成此任务的准备好的脚本。



您还有第三种方式。



您可以将您的客户添加到您的数据库并授予他们执行多个存储过程以获取数据的权限。



因此,您的客户可以在需要时更新数据。

您不会每天发送任何文件。



此外,您可以使用免费的SaveToDB Express加载项将Excel用作功能丰富的报表工具。

http://www.savetodb.com/help4/savetodb-getting-started.htm [ ^ ]
You have two big choices:

1. To create the target Excel workbook every time.
2. To update the data in the existing Excel workbook.

Look this article if you want to create the workbook:
http://www.excel-sql-server.com/sql-server-export-to-excel.htm[^]

The second way is based on using a script that does the following:

1. Opens the workbook.
2. Updates connected tables.
3. Closes the workbook.

This is a good solution as you can customize workbooks for your customers.
You may find ready scripts for this task.

You also have the third way.

You may add your customers to your database and give them permissions to execute several stored procedures to get the data.

As a result, your customers can update the data when they want.
You do not send any file on daily basis.

In addition, you may use the free SaveToDB Express add-in to use Excel as a feature-rich reporting tool.
http://www.savetodb.com/help4/savetodb-getting-started.htm[^]


这篇关于如何每天将数据从数据库中提取到Excel中并将excel放入指定位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆