使用SSIS脚本任务刷新Excel

VA.*_*VA. 2 vbscript excel ssis refresh

我有一个Excel文件,从数据库表中获取外部数据.我需要自动刷新文件并通过电子邮件发送.我打算使用SSIS脚本任务来运行一些VB脚本来打开文件,刷新数据,保存和关闭(显然没有启动应用程序).然后我将使用电子邮件任务通过电子邮件发送文件.我只需要刷新文件的脚本,并在VB或C#中作为总noob我不得不问是否有人有一个脚本可以解决这个问题,我可以自定义我的文件并在我的脚本任务中使用.我会感激任何提示!弗拉德,非常感谢

4m0*_*m01 7

希望这是你要找的

 ' Create an Excel instance
   Dim oExcel
   Set oExcel = CreateObject("Excel.Application") 

 ' Disable Excel UI elements
   oExcel.Visible = True
   oExcel.DisplayAlerts = False
   oExcel.AskToUpdateLinks = False
   oExcel.AlertBeforeOverwriting = False

   Set oWorkbook = oExcel.Workbooks.Open("absolute path to your file")
   oWorkbook.RefreshAll
   oWorkbook.Save

   oExcel.Quit
   Set oWorkbook = Nothing
   Set oExcel = Nothing
Run Code Online (Sandbox Code Playgroud)