简体   繁体   English

如何定期将Excel数据导出到SQL Server

[英]How to export Excel data to SQL server periodically

I have a table in SQL Server for indices, and a spreadsheet which is updated every week for the most recent data. 我在SQL Server中有一个用于索引的表,以及一个电子表格,该电子表格每周更新一次以获取最新数据。 I am looking for an automatic way (VBA? macro? ...?) to export the new data in spreadsheet to the existing table in SQL server to keep the database updated. 我正在寻找一种自动方式(VBA?宏?...?)将电子表格中的新数据导出到SQL Server中的现有表,以保持数据库更新。

You can use an SSIS package to import the data. 您可以使用SSIS包来导入数据。 You can also use SQL agent to set a schedule. 您还可以使用SQL代理设置时间表。

You can even get SQL to create the SSIS package for you. 您甚至可以获取SQL为您创建SSIS包。 If you right click the DB in SSMS and choose tasks -> Import Data. 如果右键单击SSMS中的数据库,然后选择任务->导入数据。 The wizard will walk you through the import and ask if you want it to produce the SSIS package. 该向导将引导您完成导入,并询问是否要生成SSIS包。

Looks like you can use an excel workbook as a linked server: 看起来您可以将excel工作簿用作链接服务器:

http://www.excel-sql-server.com/excel-import-to-sql-server-using-linked-servers.htm http://www.excel-sql-server.com/excel-import-to-sql-server-using-linked-servers.htm

From there you can just write a script to update the table and schedule it. 从那里,您可以编写脚本来更新表并计划表。

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

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