#Install-Module ImportExcel -scope CurrentUser $path="C:\Scripts" #target folder cd $path; $csvs = Get-ChildItem .\* -Include *.csv $csvCount = $csvs.Count Write-Host "Detected the following CSV files: ($csvCount)" foreach ($csv in $csvs) { Write-Host " -"$csv.Name } $excelFileName = $path + "\" + $(get-date -f yyyyMMdd) + "_combined-data.xlsx" Write-Host "Creating: $excelFileName" foreach ($csv in $csvs) { $csvPath = $path + $csv.Name $worksheetName = $csv.Name.Replace(".csv","") Write-Host " - Adding $worksheetName to $excelFileName" Import-Csv -Path $csvPath | Export-Excel -Path $excelFileName -WorkSheetname $worksheetName
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)