Trying to convert a text file with delimiters into excel
Hello, I was wondering if you can help me
I’m trying to convert a txt file with delimiters into an excel file
target:enter image description here
Current: enter image description here
The first row has commas, and row 2 onwards |
import pandas as pd
input_file_path = ‘path.txt’
output_file_path = ‘path.xlsm’
df = pd.read_csv(input_file_path, sep=’|’, header=None)
df.drop([0], inplace=True)
df.to_excel(output_file_path, index=False, header=False)
print(“File saved successfully.”)
Can someone please tell me where i’m going wrong?
Thank you