Combine multiple excel/csv files into single file
1. Put all your files under the folder c:\test\csvfiles
2. open the notepad and copy the below code and paste it , and name the file as mergefile.ps1 and store it on the c:\test drive
get-childItem "C:\test\csvfiles\*.csv" | foreach {
$filePath = $_
$lines = Get-Content $filePath
Add-Content ".\merged_report.csv" $lines
Add-Content ".\merged_report.csv" "`n"
}
3.Open the powershell and run the ps1 file.
4.the merged/single file output will be stored on the c:\test
No comments:
Post a Comment