I am using python 3.7 and I wanted to convert .xlsx file into .txt file and below is my code:
import pandas as pd
dataframe1 = pd.read_excel(r'C:\path\exceldata1.xlsx', index=False)
print(dataframe1)
with open(r'C:\path\exceldata1.txt', 'w') as text_file:
dataframe1.to_string(text_file)
I am able to convert .xlsx into .txt but I am also getting the index value printed in the text file. I want to remove that.
0 9100499S 1
1 9100099S 10
2 910000SW 1
3 91Y961SR 5
4 9120301S 20
above is the text file created but I do not need the index values in the first column.
and i also wanted to separate the two column values by tab to make it into a TVS text file so that they do not come in one cell..How do i go about it??
9100499S 1
9100099S 10
910000SW 1
91Y961SR 5
9120301S 20