Convert Text File to Excel File Using Python Script

Hello, I need to convert a text file to Excel file using python only. kindly help me with the code & steps.

Hello @Naga_bhushan , Welcome to Uipath Community

Kindly refer this for python Code

For more steps in uipath with python, Refer this

Hi @Naga_bhushan,

Can you tell us the use case, also with some examples.


Hey @Gokul_Jayakumar. Thank you for this, currently working on it, will give you an update.

Hey @shikar_tandon, pls find attached text file. I need to convert this to excel with first line as a header.

data.txt (2.3 KB)

Hi @Naga_bhushan ,
as your input file has “|” as delimiter
kindly try the below code in invoke activity
'<inputfilepath.xlsx>’ and '<outputfilepath.xlsx>’ are arguments to be provided

import pandas
df=pandas.read_table('<inputfilepath.xlsx>‘, delimiter = ‘|’)
df.to_excel('<outputfilepath.xlsx>’, index=False, header=True)

attached excel output file,
output_with_header.xlsx (6.5 KB)

Hello @Naga_bhushan

In the below video you can refer to the python part to understand the steps.

Python-Powershell to create automated HTML health status reports |Easy to scale


This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.