Inserting text file to CSV

Hello,

I have this project which simply insert all the text file content to csv. The column of the csv must be like this
image
and here are my text files
Ammar, The F.txt (13 Bytes)
Capela, Clint.txt (14 Bytes)
Cruz, Jonathan.txt (19 Bytes)
inside of those text file are age, gender and address. I need to use the file name as the First Name and Last Name so I need to insert those file name also on the FirstName and LastName fields in csv. How to execute it?

use add data row activity pass your input through the array

@Jomari_Tenedero
Please follow and try steps:

  1. Add Bulid Data table actvity, create required format.
  2. Read the text file and split those values and store as a variable.
  3. Use Add row activity, pass those variable in order of build data table by pass array{}
  4. write those values in excel shets using write Excel, and if already excel file have, create rule for file exist and append the values.
  5. finally clear Dt value of build datatable, to avoid the duplicate value while looping the process
    image

Hi @Jomari_Tenedero ,

Sharing some tips/suggestions it might help you to achieve your requirements.

  1. use For each file in folder activity to get all the text files one by one.
  2. in that activity have functions to get the name of the text file and full path of the text file. by using the name of the file you can get the first name and last name(using split function - string by using delimiter comma)
  3. use read text file activity to read the whole content in the text file to a string variable.
  4. use regular expression with new line to get the required values one by one from the total content.
  5. create empty data table with the headers you want and use add data row activity to add the extracted content from text file into data table.
  6. At the end of the process use write range and write the whole data into excel file.

please try the above steps to achieve the requirement. thanks.