Skip to content

Instantly share code, notes, and snippets.

@Anas-jaf
Created August 14, 2023 18:50
Show Gist options
  • Save Anas-jaf/7e244a85fba381fb083e35d39758af1e to your computer and use it in GitHub Desktop.
Save Anas-jaf/7e244a85fba381fb083e35d39758af1e to your computer and use it in GitHub Desktop.
# Create a new Excel Application object
$excelApp = New-Object -ComObject Excel.Application
# Set visibility to true (to make Excel visible)
$excelApp.Visible = $true
# Get a list of all Excel files in the current folder
$excelFiles = Get-ChildItem -Path . -Filter *.xlsx
# Loop through the list and open each Excel file
foreach ($file in $excelFiles) {
$workbook = $excelApp.Workbooks.Open($file.FullName)
}
# When you're done, you can close Excel
#$excelApp.Quit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment