将 Excel 工作表保存到 SQL 中

发布于 2024-09-07 18:49:10 字数 161 浏览 3 评论 0原文

Excel 在“数据”选项卡中有一个“获取外部数据”功能区栏,我们可以在其中选择从 SQL 数据库导入表。这个过程对我来说效果很好。但我的问题是,有什么办法可以将这些数据保存回 SQL 中吗? Excel 是否提供了一些 API 来促进此类函数的编码,而无需解析所有内容并从头开始执行?

谢谢

Excel has a Get External Data ribbon bar in the Data tab where we can choose to import tables from SQL databases. This process worked out nicely for me. But my question is, is there any way to save this data back into SQL? Does Excel provide some API that facilitates the coding of such a function without parsing everything and doing it from scratch?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

金橙橙 2024-09-14 18:49:10

它可能不是您正在寻找的解决方案,但我很久以前发布了一些 VBA 代码,它将获取 Excel 中的范围并将其转换为 XML 并构建 SQL 以将该数据放入 SQL Server 中的临时表中。如果您有兴趣,这里有一个链接

It may not be the solution you are looking for, but I posted some VBA code a long while back that will take a range in Excel and convert it to XML and builds the SQL to put that data into a temp table in SQL Server. Here's a link if you are interested.

水水月牙 2024-09-14 18:49:10

最简单的方法是使用 SSMS 中的导入功能。您可以选择要使用的工作表、自定义列映射等。如果创建一个 SSIS,您可以根据需要进一步操作。然而,这种方法是从 Sql 拉取的,而不是从 Excel 推取的,如果你想这样做,你必须编写一些 VBA 来为你完成它。

The easiest way to do this is to use the import function within SSMS. You can select which sheets to use, customise column mappings and so on. If creates an SSIS that you can then manipulate further if required. However that approach is a pull from Sql, not a push from Excel, if you want to do that you'd have to code some VBA to do it for you.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文