Notepad file to excel file

i have notepad file in specified location.i want to read that file and convert into excel.
“how to read notepad file and copy all date to csv”

i have notepad file in specified location.i want to COPY that file and PASTE into excel.
“how to COPY notepad file and PASTE in EXCEL”

Fine
Hope these steps would help your resolve this
—use read text file activity if that notepad has a txt file in it and get the output with a variable of type string
—followed by that use a generate datatable activity and pass the above string as input and get the output with a variable of type datatable named dt
—now we can use write range activity where pass this dt as input
Or
If the file is a csv file use read csv activity and get the output with a variable of datatable named dt
—now use write range activity where pass this dt as input and that would write it to a excel file

Cheers @Ananya1

1 Like

notepad has text file

there will be multiple files in one folder. and file name would be different everytime

so ,how to handle?

Would you like to take all files or a specific files
Cheers @Ananya1

all files

write range activity is valid only if excel application scope is used

and i want to save excel file with that same name of txt file

Fine
Does all the files have structured data with it
@Ananya1

all files are in notepad with .txt

every file has different data

Yes that’s fine
I would like to know how is the structure of data in those txt files
Is it like tabular form
Cheers @Ananya1

separated by comma

Great
—So use a assign activity like this
Arr_filepath = Directory.GetFiles(“yourfolderpath”,”*.txt”)

Where Arr_filepath is a variable of type array of string
—now use a for each activity where pass this Arr_filepath as input and change the type argument as string in the property panel
—inside the loop use a Read text File activity and get the Output with a variable of type string named str_input
—now use a Generate l Datatable activity where pass this string as input and get the output with a variable of type datatable named dt
—the use a excel application scope activity and mention the file path excel you want and inside the scope use a write range activity and mention she sheet name as “sheet”+counter.ToString and in the range mention as “” and in the input datatable mention as dt
Where counter is a int32 variable I’m with default value as 1 defined in the variable panel
—next to this scope use a assign activity while we are still inside the for each loop
counter = counter + 1

So that each text file will be written in each sheet in the same excel file

Hope this would help you
Cheers @Ananya1

every text file will have seprate excel file

what i want
open text file,copy contents,paste it in excel

Fine then remove the counter variable and it’s increment and also just sheetname as “sheet1”
So in the excel application scope mention the file path like this
“Yourfolderpath\”+”Yourfilename”+”_”+Now.ToString(“hh_mm_ss”)+”.xlsx”

So this will create a new excel for each iteration
Cheers @Ananya1

can u please share workflow?

1 Like

Sorry buddy
I m getting through with my mobile
But will be with you… don’t worry
We can do this…let’s try if you face any issue let us know
The sequence be like this
—assign with arr_filepath
—for each loop with arr_filepath as input
—inside the loop use a read text file and get the output as string
—then use Generate datatble activity and get the output as dt
—now use a excel application scope With this as Filename
“Yourfolderpath\”+”Yourfilename”+”_”+Now.ToString(“hh_mm_ss”)+”.xlsx”
—inside then scope use a write range and don’t change any input just mention the datatable as dt
—that’s all you are done @Ananya1

Cheers @Ananya1

thank u

1 Like