0

Iam not very familiar with powershell, I want to import csv data from multiple csv files in a directory. The files have the same structure, however I need to filter the output with a delimiter, because sadly all the data is compressed in one column.

I managed to import a single csv file with:

Import-Csv -Path C:\data\test.csv -Delimiter ‘;’  | select "Instance Name","Database ID","Database Name" .......

and successfully got a valid output in separate columns.

How can I actually pass multiple files one after another? After the import I want to export the data into MSSQL tables to work with it later on.

Thanks and BR, Patrick

  • https://stackoverflow.com/questions/50252209/insert-data-row-wise-in-a-sql-table-from-a-csv-using-powershell – Vivek Kumar Singh Mar 15 '19 at 13:05
  • Use a foreach to iterate the files from a `Get-ChildItem` i.e. `foreach ($File in (Get-ChildItem -Path 'C:\data\*.csv')){Import-Csv $File -Delim ';' | Select-Object ....}` –  Mar 15 '19 at 15:38

0 Answers0