Created
November 20, 2018 10:36
-
-
Save matt40k/9c770234bbd5497a64f532a4a17c4cd6 to your computer and use it in GitHub Desktop.
Update the data in Excel files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$dir = "c:\temp\" + (Get-Date).ToString("yyyy-MM-dd") | |
Write-Host $dir | |
$excelObj = New-Object -ComObject Excel.Application | |
$excelObj.Visible = $true | |
$files = Get-ChildItem -Path $dir | |
foreach ($file in $files) | |
{ | |
$filePath = $file.FullName | |
$workBook = $excelObj.Workbooks.Open($filePath) | |
$workBook.RefreshAll() | |
$workBook.Save() | |
$workBook.Close() | |
} | |
$excelObj.Quit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment