Nov-19-2022, 11:59 AM
Interesting. I cut your example data and pasted into a file named result.txt. I cut the program and pasted it into a file named test.py. I ran the program and it generated test.xlsx. I opened test.xlsx and it looks like this:
Output:datettime Tput RbNum MCS PdschBler nonWPdschBler
20221108.181509.814817 0.00 2.50 9 0 25
20221108.181519.814948 0.00 1.90 9 0 50
And because the header row doesn't have a bunch of extra spaces between the column headers, the program can be even simpler.import pandas as pd with open("result.txt", "r") as file: df = pd.read_csv(file, sep=" ") df.to_excel("test.xlsx", index=False)