Forum Discussion
Baron164
Mar 21, 2022Brass Contributor
Need to convert a text file into a CSV
I have a text file from payroll that includes all active employees and their relevant information such as Phone Number, Office Location etc. I need to convert this file into a CSV so I can more easil...
Mar 22, 2022
Could you post it as text file? This is easy in Excel, fixed width, but this is not easy in PowerShell IMHO because of the lack of delimeters.. I Don't know what software your Payroll is, but no csv option in a somewhat modern piece of software?!
Baron164
Mar 22, 2022Brass Contributor
I do not see an option of attaching a text file to my posts so I put an example text file here. https://1drv.ms/t/s!AoktdqajV6ZomugfGxVBbjxHMnua7A?e=rHqB3P
The list is updated on a regular basis so this process needs to be automated. And unfortunately I am not able to make changes to the export process at this time so I'm stuck dealing with the file as is.
The list is updated on a regular basis so this process needs to be automated. And unfortunately I am not able to make changes to the export process at this time so I'm stuck dealing with the file as is.
- Mar 22, 2022
Baron164 I think you can use something like this per line, the FIRST_NAME value is $line.SubString(0,5) for example. MI is $line.SubString(31,1). If everything always has the same starting point and a max amount of characters.. You can make variables out of that as input for your update script
- Baron164Mar 22, 2022Brass ContributorOk, so regards to "(31,1)", is 31 the space where that field begins? If that's the case then what does the 1 represent?
- Mar 22, 2022The amount of characters, could be 2 to include the "."