Import txt file to xls with format
-
mercoledì 27 giugno 2012 03:50Hello!
I have a text file separated by a semicolon.
several fields have numbers with leading zero. For example:
001; Brian Murray;27342323;Mechanic;Miami;05;Active
I need to import this file and pass it to a excel without losing formatting. That is, Excel does not convert the 001 in 1 or 05 in 5.
Who can give me a hand to appreciate it.
regards,- Modificato castnh mercoledì 27 giugno 2012 03:52
Tutte le risposte
-
mercoledì 27 giugno 2012 05:56
Hello!
I have a text file separated by a semicolon.
several fields have numbers with leading zero. For example:
001; Brian Murray;27342323;Mechanic;Miami;05;Active
I need to import this file and pass it to a excel without losing formatting. That is, Excel does not convert the 001 in 1 or 05 in 5.
Who can give me a hand to appreciate it.
regards,
Depending on your data you could just replace those zeros with nothing and later on convert the .csv to and excel an Excel file :)
$import = get-content -Path 'C:\Users\Alexander Bosshard\Desktop\test1.txt' $import.replace('0','') | Out-File -FilePath 'C:\Users\Alexander Bosshard\Desktop\test2.txt'
Regards / Freundliche Grüsse King Julien
- Modificato King Julien mercoledì 27 giugno 2012 07:18
-
mercoledì 27 giugno 2012 13:15
Julien, thanks for the quick response.
No I have to remove the zeros, I must keep.
contents. txt
001;Microsoft;software;03;004;Active
to import it into Excel is as follows:1 Microsoft software 3 4 Active
I need you to be like this:
001 Microsoft software 03 004 ActiveSorry for my bad English
Deshacer cambiosThanks

