Can converting text file to CSV an option for you? It can be leveraged in case you have a delimiter in the text file.Because my file has more than half a Million entries.
I tried this. My delimiter is " |" and my data has headers. I somehow Need to delete the first two (filled) files and then I could apply Import to CSV.
import-csv pipeDelimitedText.txt -delimiter "|" | export-csv csvpipefile.csv -NoType