Pergunta

I am importing csv file of size 24MB but each time it is truncated to 0KB and shows following error.

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

$data = Import-Csv <<<< $path + CategoryInfo : InvalidArgument: (:) [Import-Csv], PSArgumentException + FullyQualifiedErrorId : Argument,Microsoft.PowerShell.Commands.ImportCsvCommand

Property 'Column4' cannot be found on this object; make sure it exists and is settable.

       $_. <<<< Column4 = $separated[3] + $_.Column2 + $_.Column3

+ CategoryInfo : InvalidOperation: (Column4:String) [], RuntimeException + FullyQualifiedErrorId : PropertyNotFound

Export-Csv : Cannot bind argument to parameter 'InputObject' because it is null.

$data | Export-Csv <<<< $path -NoTypeInformation + CategoryInfo : InvalidData: (:) [Export-Csv], ParameterBindingValidationException + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.ExportCsvCo mmand

The powershell script that I am using works fine for small size of file (say 24KB). Is there any upper limit for size of input csv file.

Foi útil?

Solução 2

The error was due to trailing columns in the csv file. While converting an Excel file to csv file, the trailing columns of Excel file got add to the csv file. So, to solve the problem, delete all the trailing columns from the Excel file and then convert it to csv file.

Outras dicas

I have processed csv files that are gigabytes in size, so size is not the issue.

If you have successfully processed other files with the SAME code then I suspect that there is some corruption somewhere in your file that is causing the error.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top