Sunday 15 March 2015

powershell - Cannot Import CSV file using Import-Csv -


I am trying to use import-CSV after exceling a CSV file into a CSV file. I'm getting the following error

Import-Csv: Can not process logic because the value of the argument "name" is invalid. Change the value of the "name" argument and run the operation again.

This is the script that I am trying to convert XML files to CSV and import CSV files at command prompt.

  $ dst = "O: UserCert \ target \ "$ Excel = New Object-Com Excel.Application $ Excel.visible = $ False $ Excel.displayalerts = $ False foreach (IN $ file) Gci" O: \ UserCert \ *. Xls ") {$ wb = $ Excel.Workbooks.Open ($ file.fullname) $ wb.SaveAs ($ dst + $ file.Basename + ".csv", 6) $ wb ($ True)} $ excel.Quit ()   

Am I making a mistake in the conversion that was not able to understand import-csv ? I sometimes experience this using <<> code- import-csv .

  1. file

    To fix this, there is a conversion problem when saving .xlsx to .csv to fix it.

  2. CSV (CAM delimited) (* .csv)

    I do the following:

    1. Start a new Excel example
    2. Contents of my Excel spreadsheet
    3. Copy Paste

      We "copy-paste", we effectively copy only and External content cells, while the exports "save as" also have empty columns and rows.

      By comparing a functional CSV and a non-functional CSV, we can see that two additional columns and a few empty rows are being created in my case ( potentially in the empty column Was used to become content ).

      Therefore, using another solution, empty columns and rows near the content and then saving is normally used. Alternatively, edit the CSV file and delete two empty columns for each line.

No comments:

Post a Comment