I have several Excel files larger than 20 MB, and they need to be updated every week before starting a business (Monday, 8am).
These files contain one data sheet, and the data comes through an external connection (ODC file) from the SQL Server view.
They also have one summary sheet, which also needs to be updated after updating the data sheet.
I am trying to find a solution (Windows PowerShell) to automate updating data and pivot sheets without having to touch files. Refresh on open and other Excel options are not viable since it takes up to 20 minutes to upgrade all connections.
I also do not want to update ALL sheets, because the file has a custom coloring for charts, and โRefreshโ resets it in Excel by default, which cannot be.
I tried this, but it doesn't seem to work with an ODC connection? At least he does nothing:
Windows PowerShell :
$ExcelApp = new-object -ComObject Excel.Application $ExcelApp.Visible = $false $ExcelApp.DisplayAlerts = $false $Workbook = $ExcelApp.Workbooks.Open("c:\test\ref_test.xlsx", 3, $false, 5, $null, $null, $true) Start-Sleep -s 30 $Workbook.RefreshAll() $Workbook|Get-Member *Save* $Workbook.Save() $ExcelApp.Quit()
Any ideas?
Office Version: 2010, Windows 7
sql vba powershell excel
Kathyblue
source share