Updating CSV cells

Afternoon all.

I’m trying to update csv cells after finding the right one… It works on small files but my sheet is 15,000 rows and my script hangs…
Is there anyway to improve it?

function bookINGEM {

$Eng = (get-qaduser $user).displayName
$DelDate = (Get-Date -format d)
$Refe = $SerialRef.text
$file = "C:\temp\Tracker.csv"

$csv = Import-Csv $file 


foreach($row in $csv) 
{
if ($row.SerialNo -eq $Refe) {
    $row.HostName = $BoxHost.text
    $row.Asset = $BoxAsset.text
    $row.Location = "LOCXXXXXX"
    $row.LifeCycleStatus = "In Stock"
    $row.SubStatus = "Available"
    $row.Date = $DelDate
    $row.Updated = $Eng   
}

$csv | Export-Csv  $file -NoTypeInformation;
}
$StatusBarPanel.text = "Updated"
}

Hi Andy,
just change the code from:

}

$csv | Export-Csv  $file -NoTypeInformation;
}

to:

}
}
$csv | Export-Csv  $file -NoTypeInformation;

So in other words, just move output to the file out of the foreach loop and update only at the end, and it will take you a blink of an eye to complete the update
regards
fra