Skip to content

Instantly share code, notes, and snippets.

@jpomfret
Created October 14, 2019 21:46
Show Gist options
  • Save jpomfret/0fd20467b56125e387c66e6cab8d4385 to your computer and use it in GitHub Desktop.
Save jpomfret/0fd20467b56125e387c66e6cab8d4385 to your computer and use it in GitHub Desktop.
Read Excel Files in and Export CSVs
# Source for xlsx files
$SourceFolder = 'C:\Folder'
# Destination folder for where the csvs will go
$DestFolder = 'C:\Folder\csv'
# Foreach Excel file, read it in and then export to CSV with the same name.
Get-ChildItem $SourceFolder -Filter *.xlsx |
ForEach-Object { Import-Excel $_.FullName | Export-Csv -Path ("{0}\{1}.csv" -f $DestFolder, $_.basename) -NoTypeInformation }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment