如何从计划的 SSIS 包更新 Excel 工作簿?

How can I update an Excel workbook from a scheduled SSIS package?

我有一个导入数据的 SSIS 包,然后需要更新一个 Excel 工作簿以发送电子邮件。 Excel 工作簿包含许多设置为打开时自动刷新的数据连接。

我尝试了多种打开 Excel 工作簿以在发送电子邮件之前强制刷新的方法,并且当我 运行 来自 Visual Studio 的包时它们都有效,但是没有在被 SQL 服务器代理调用时无法工作。

使用 Jessica Moss 的 this code,我收到此错误

DTExec: The package execution returned DTSER_FAILURE (1)

使用 codeplex 中的 SSIS Excel Refresh Task package 我得到这个错误

The Execute method on the task returned error code 0x800A03EC 
(Microsoft Excel cannot access the file '[my filename]')

使用 powershell update script 我得到这个错误。

DTExec: The package execution returned DTSER_FAILURE (1)

代理正在通过具有所有必要权限的代理帐户执行。 Excel 安装在服务器上。

当从 SQL 服务器代理 运行ning 时如何更新工作簿?

进入系统配置文件目录

%windir%\System32\config\systemprofile

创建一个名为 desktop

的文件夹

现在 Excel 工作簿将使用上述任何方法进行更新。