Extracting variables from .txt file


Hi, I’m working on a project where I have to use a text file, extract only some values and save them in variables.
In the file txt I’ll attach for example there is the line called “Marca”: I need to extract in a variable the value Honda associated to it. (The same for the successive rows in the file .txt)
Is there someone so kind who wants to help me?




JAZZ 2ª SERIE 08-15

Valore assicurato



Tipo Guida
CC / KW / Cavalli fiscali

1198 / 66 / 14

Compagnia di appartenenza




Hi @CamiCat,
use Read Text File activity to get the string value.(strvalue)
split the string value using Environment.NewLine
strvalue.Split(Environment.NewLine.ToArray, StringSplitOptions.RemoveEmptyEntries)
using build data table activity to create the table (variable,value)

assign the odd the values into the variable column even values to values field.

so you will get the datatable from here you can get the value.

Extract data from .txt file

Thank you so much.
How can I build the datatable with all the pairs of (variables,values)?
In particular, how can I assign the odd values to the variable column?
Thank you so much,


I created the datatable but I can’t loop for the elements of the array in ordet to insert the variables and the corresponding values.
Can you please help me?
I have to get the project finished in a short time.
Thank you,


@CamiCat, Good to see you have started with something. That should be ,

Array.Indexof(strarr, item) mod 2 = 1 - Even Elements

Note: Meanwhile instead waiting for a reply you can search our forum and refer, where we have many solved posts.

Dom :slight_smile:


@Dominic Thank you so much.
How can I add the odd values of the array to the previously created first column?
Maybe i can use: datatablename(index)(“column name”)=item?
Thank you so much,
I’ll refer to similar posts.


@CamiCat, Good to see that you are near the Solution.

Yes. You can add the values to relevant columns based on column name or column index.

Dom :slight_smile:


Thank you @Dominic.
I tried to add the values to the corresponding columns but it gave me the following error.

How can I fix this error?
Thank you so much to anyone who gives me help,


HI @CamiCat,

can you refer this post this may be helpful for you.

Read the text file and get it into string value.
i hope you know the header value you want to extract only the value fields from the notepad.
refer the above post to get the answer.
in regex we can split the data.



Thank you so much @arivu96 .
I used regular expressions in order to extract the values between two fixed strings.
Here I attach the match activity.

How can I do to extract only the charactersin bold?
Valore Assic. 2700 € - JAZZ 1.2 I-VTECValore Assic. 4000 € - JAZZ 1.2 I-VTEC ELEGANCEValore Assic. 2700 € - JAZZ 1.2 I-VTEC VSAValore Assic. 4000 € - JAZZ 1.2 I-VTEC ELEGANCE VSAValore Assic. 2700 € - JAZZ 1.2 I-VTEC LEValore Assic. 4000 € - JAZZ 1.2 I-VTEC ELEGANCE LE
Thank you so much


Hi @CamiCat

use one more regex pattern to get the value

Use Matches activity
Input : "your input String"
Pattern : (.*(?=Valore Assic))
Result: iEnumResult ->IEnumberable
after that use assign activity to get the data
strFrom=iEnumResult (0).ToString()



Thank you so much @arivu96.
I applied regex formula several times and it worked. :slight_smile: