Parsing data from email subject

Discuss RoboTask here
Post Reply
Giup
Posts: 2
Joined: Thu Nov 27, 2025 11:56 am

Parsing data from email subject

Post by Giup »

Hello.
I would need some help to create a task with the following steps:
1. Read new email from a POP account;
2. Read value1 and value2 from email subject: values are separated by a comma;
3. Copy the values in column A and B of an excel spreadsheet with a fixed name;
4. Appending new values under the old ones, every time a task is initiated by a new email.
Thanks,
Giuseppe
Oleg
Site Admin
Posts: 3272
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: Parsing data from email subject

Post by Oleg »

1. Read new email from a POP account;
Use Email actions: POP3 Open, enumerate emails in mail box POP3 Mail Loop, POP3 Download Email
maybe you need delete downloaded email - POP3 Delete Email
2. Read value1 and value2 from email subject: values are separated by a comma;
You can convert string to standard comma-separated string and then you can read elements like this: {MySubj(0)}, {MySubj(1)} and etc.
3. Copy the values in column A and B of an excel spreadsheet with a fixed name;
4. Appending new values under the old ones, every time a task is initiated by a new email.
Use Excel actions for this
You need to find an empty cell in specified column.
To read cells use Excel Get Cells
To write cell use Excel Set Cells

Do not forget to save EXCEL document at the end of task. Any changes will not be saved automatically.
Oleg Yershov
Giup
Posts: 2
Joined: Thu Nov 27, 2025 11:56 am

Re: Parsing data from email subject

Post by Giup »

Hello.
I'm stuck here and not able to find the first free row...

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|0
Comment=STRINGLIST
ContinueOnError=INTEGER|0
DisableOnError=INTEGER|0
DoNotStopWhenShutdown=INTEGER|0
ExternalName=STRING|"Task1"
Hide=INTEGER|0
ID=INTEGER|-1049195316
LogOnAsUser=INTEGER|1
Name=STRING|"POP3 Open..."
OnErrorTaskID=INTEGER|0
Priority=INTEGER|3
RestrictRESTAPIAccess=INTEGER|0
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
StepPause=INTEGER|0
ToLog=INTEGER|3
UnicodeFormat=INTEGER|1
WriteGeneralLog=INTEGER|0

[Actions]
Action1=FOLDER
Action10=FOLDER
Action11=FOLDER
Action12=FOLDER
Action13=FOLDER
Action14=FOLDER
Action15=FOLDER
Action16=FOLDER
Action17=FOLDER
Action18=FOLDER
Action2=FOLDER
Action3=FOLDER
Action4=FOLDER
Action5=FOLDER
Action6=FOLDER
Action7=FOLDER
Action8=FOLDER
Action9=FOLDER

[Actions\Action1]
ActionID=STRING|"A_EMAIL_OPEN"
Enabled=INTEGER|-1
Name=STRING|"POP3 Open"
Params=FOLDER

[Actions\Action1\Params]
host=STRING|"mailgal.gallozzi.com"
oauthmode=STRING|"0"
password=STRING|"33896434534423247062286132855615756"
port=STRING|"110"
SSL=STRING|"0"
SSL2=STRING|"0"
SSL3=STRING|"0"
TLS10=STRING|"1"
TLS11=STRING|"1"
TLS12=STRING|"1"
user=STRING|"test.gg@mailgal.gallozzi.com"

[Actions\Action10]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""count_row_number"" with value ""{row_nr}+1"""
Params=FOLDER

[Actions\Action10\Params]
_rt_variables_produced=STRING|"count_row_number"
expand=STRING|"0"
linecount=STRING|"1"
varname=STRING|"count_row_number"
varvalue=STRING|"{row_nr}+1"

[Actions\Action11]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|-1
Name=STRING|"End If"

[Actions\Action12]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"

[Actions\Action13]
ActionID=STRING|"A_LOOPARRAYELEMENTS"
Enabled=INTEGER|-1
Name=STRING|"Loop on comma-separated string"
Params=FOLDER

[Actions\Action13\Params]
_rt_variables_produced=STRING|"CurrentArrayElement"
delimiter=STRING|"0"
mode=STRING|"0"
quotechar=STRING|"0"
source=STRING|"{MySubj}"
strictdelimiter=STRING|"1"
variable=STRING|"CurrentArrayElement"

[Actions\Action14]
ActionID=STRING|"A_EXCEL_SET"
Enabled=INTEGER|-1
Name=STRING|"Excel Set Cells"
Params=FOLDER

[Actions\Action14\Params]
cell00000000=STRING|"A{count_row_number}"
cell00000001=STRING|"B{count_row_number}"
count=STRING|"2"
setmode=STRING|"0"
var00000000=STRING|"{MySubj(0)}"
var00000001=STRING|"{MySubj(1)} "
worksheet=STRING|"1"

[Actions\Action15]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"

[Actions\Action16]
ActionID=STRING|"A_EXCEL_SAVEDOC"
Enabled=INTEGER|-1
Name=STRING|"Excel Save Document"

[Actions\Action17]
ActionID=STRING|"A_EXCEL_CLOSE"
Enabled=INTEGER|-1
Name=STRING|"Excel Close"

[Actions\Action18]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"

[Actions\Action2]
ActionID=STRING|"A_EMAIL_LOOP"
Enabled=INTEGER|-1
Name=STRING|"POP3 Mail Loop"
Params=FOLDER

[Actions\Action2\Params]
_rt_variables_produced=STRING|"1,subject"
breakafter=STRING|"0"
limit=STRING|"100"
number=STRING|"1"
reverse=STRING|"0"
subj=STRING|"subject"
usecc=STRING|"0"
usedate=STRING|"0"
usefrom=STRING|"0"
usepriority=STRING|"0"
usesize=STRING|"0"
usesubj=STRING|"1"
useto=STRING|"0"

[Actions\Action3]
ActionID=STRING|"E_EMAIL_DOWNLOAD"
Enabled=INTEGER|-1
Name=STRING|"POP3 Download Message"
Params=FOLDER

[Actions\Action3\Params]
extract=STRING|"0"
num=STRING|"1"
overwrite=STRING|"0"
savefilenames=STRING|"0"
savetofile=STRING|"{TempDir}\{Year}{MonthNo}{Day}{Hours}{Minutes}{Seconds}{mSeconds}.eml"

[Actions\Action4]
ActionID=STRING|"A_VARIABLES_DELIMITED"
Enabled=INTEGER|-1
Name=STRING|"Split Text"
Params=FOLDER

[Actions\Action4\Params]
_rt_variables_produced=STRING|"MySubj"
colon=STRING|"0"
comma=STRING|"1"
other=STRING|"0"
otherchar=STRING|" "
quote=STRING|"2"
semocolon=STRING|"0"
space=STRING|"0"
spaceasone=STRING|"1"
string=STRING|"{subject}"
tab=STRING|"0"
variable=STRING|"MySubj"

[Actions\Action5]
ActionID=STRING|"A_EXCEL_OPEN"
Enabled=INTEGER|-1
Name=STRING|"Excel Open Document"
Params=FOLDER

[Actions\Action5\Params]
filename=STRING|"C:\Users\Giuseppe Lamberti\Desktop\lista_dogane.xlsx"
hide=STRING|"0"
mode=STRING|"0"
tryconnect=STRING|"0"

[Actions\Action6]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""row_nr"" with value ""1"""
Params=FOLDER

[Actions\Action6\Params]
_rt_variables_produced=STRING|"row_nr"
expand=STRING|"0"
linecount=STRING|"1"
varname=STRING|"row_nr"
varvalue=STRING|"1"

[Actions\Action7]
ActionID=STRING|"A_LOOP_WHILE"
Enabled=INTEGER|-1
Name=STRING|"While loop"
Params=FOLDER

[Actions\Action7\Params]
case=STRING|"0"
connection=STRING|"0"
count=STRING|"1"
operator=STRING|"4"
type=STRING|"1"
value1=STRING|"{row_nr}"
value2=STRING|"100"

[Actions\Action8]
ActionID=STRING|"A_EXCEL_GET"
Enabled=INTEGER|-1
Name=STRING|"Excel Get Cells"
Params=FOLDER

[Actions\Action8\Params]
_rt_variables_produced=STRING|"valA,valB"
cell00000000=STRING|"A{row_nr}"
cell00000001=STRING|"B{row_nr}"
count=STRING|"2"
var00000000=STRING|"valA"
var00000001=STRING|"valB"
worksheet=STRING|"1"

[Actions\Action9]
ActionID=STRING|"A_FLOW_IF"
Enabled=INTEGER|-1
Name=STRING|"If Then"
Params=FOLDER

[Actions\Action9\Params]
case=STRING|"0"
connection=STRING|"0"
count=STRING|"1"
operator=STRING|"8"
type=STRING|"0"
value1=STRING|"{valA} And {valB}"
value2=STRING|""""""
Oleg
Site Admin
Posts: 3272
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: Parsing data from email subject

Post by Oleg »

Look at my example below
Save the text of the task to a file and use menu Task->Import to import the task into RoboTask.
Also you can simply copy task text and paste it into the task list.

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|1133661666
Comment=STRINGLIST
ContinueOnError=INTEGER|0
DisableOnError=INTEGER|0
DoNotStopWhenShutdown=INTEGER|0
ExternalName=STRING|"Task87"
Hide=INTEGER|0
ID=INTEGER|-1448138562
LogOnAsUser=INTEGER|1
Name=STRING|"How to find an empty row"
OnErrorTaskID=INTEGER|0
Priority=INTEGER|3
RestrictRESTAPIAccess=INTEGER|0
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
StepPause=INTEGER|0
ToLog=INTEGER|3
UnicodeFormat=INTEGER|1
WriteGeneralLog=INTEGER|0

[Actions]
Action1=FOLDER
Action10=FOLDER
Action11=FOLDER
Action12=FOLDER
Action13=FOLDER
Action14=FOLDER
Action15=FOLDER
Action2=FOLDER
Action3=FOLDER
Action4=FOLDER
Action5=FOLDER
Action6=FOLDER
Action7=FOLDER
Action8=FOLDER
Action9=FOLDER

[Actions\Action1]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""_excelDoc"" with value ""C:\temp\example.xlsx"""
Params=FOLDER

[Actions\Action1\Params]
_rt_variables_produced=STRING|"_excelDoc"
expand=STRING|"0"
linecount=STRING|"1"
varname=STRING|"_excelDoc"
varvalue=STRING|"C:\temp\example.xlsx"

[Actions\Action10]
ActionID=STRING|"A_EXCEL_SET"
Enabled=INTEGER|-1
Name=STRING|"Excel Set Cells"
Params=FOLDER

[Actions\Action10\Params]
cell00000000=STRING|"A{row_nr}"
cell00000001=STRING|"B{row_nr}"
count=STRING|"2"
setmode=STRING|"0"
var00000000=STRING|"{_mySubj(0)}"
var00000001=STRING|"{_mySubj(1)}"
worksheet=STRING|"1"

[Actions\Action11]
ActionID=STRING|"A_LOOP_BREAK"
Enabled=INTEGER|-1
Name=STRING|"Break"

[Actions\Action12]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|-1
Name=STRING|"End If"

[Actions\Action13]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"

[Actions\Action14]
ActionID=STRING|"A_EXCEL_SAVEDOC"
Enabled=INTEGER|-1
Name=STRING|"Excel Save Document"

[Actions\Action15]
ActionID=STRING|"A_EXCEL_CLOSE"
Enabled=INTEGER|-1
Name=STRING|"Excel Close"

[Actions\Action2]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""_mySubj"" with value ""ColA_{RandomValue(1000)},ColB_{RandomValue(1000)}"""
Params=FOLDER

[Actions\Action2\Params]
_rt_variables_produced=STRING|"_mySubj"
expand=STRING|"1"
linecount=STRING|"1"
varname=STRING|"_mySubj"
varvalue=STRING|"ColA_{RandomValue(1000)},ColB_{RandomValue(1000)}"

[Actions\Action3]
ActionID=STRING|"A_EXCEL_OPEN"
Enabled=INTEGER|-1
Name=STRING|"Excel Open Document"
Params=FOLDER

[Actions\Action3\Params]
filename=STRING|"{_excelDoc}"
hide=STRING|"0"
mode=STRING|"0"
tryconnect=STRING|"0"

[Actions\Action4]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""row_nr"" with value ""1"""
Params=FOLDER

[Actions\Action4\Params]
_rt_variables_produced=STRING|"row_nr"
expand=STRING|"0"
linecount=STRING|"1"
varname=STRING|"row_nr"
varvalue=STRING|"1"

[Actions\Action5]
ActionID=STRING|"A_LOOP_WHILE"
Enabled=INTEGER|-1
Name=STRING|"While loop"
Params=FOLDER

[Actions\Action5\Params]
case=STRING|"0"
connection=STRING|"0"
count=STRING|"1"
operator=STRING|"4"
type=STRING|"1"
value1=STRING|"{row_nr}"
value2=STRING|"100"

[Actions\Action6]
ActionID=STRING|"A_EXCEL_GET"
Enabled=INTEGER|-1
Name=STRING|"Excel Get Cells"
Params=FOLDER

[Actions\Action6\Params]
_rt_variables_produced=STRING|"valA,valB"
cell00000000=STRING|"A{row_nr}"
cell00000001=STRING|"B{row_nr}"
count=STRING|"2"
var00000000=STRING|"valA"
var00000001=STRING|"valB"
worksheet=STRING|"1"

[Actions\Action7]
ActionID=STRING|"A_FLOW_IF"
Enabled=INTEGER|-1
Name=STRING|"If Then"
Params=FOLDER

[Actions\Action7\Params]
case=STRING|"0"
case#1=STRING|"0"
connection=STRING|"0"
count=STRING|"2"
operator=STRING|"8"
operator#1=STRING|"8"
type=STRING|"0"
type#1=STRING|"0"
value1=STRING|"{valA}"
value1#1=STRING|"{valB}"
value2=STRING|""""""

[Actions\Action8]
ActionID=STRING|"A_VARIABLES_INCREMENT"
Enabled=INTEGER|-1
Name=STRING|"Increment variable ""row_nr"""
Params=FOLDER

[Actions\Action8\Params]
incement=STRING|"1"
vaiable=STRING|"row_nr"

[Actions\Action9]
ActionID=STRING|"A_FLOW_ELSE"
Enabled=INTEGER|-1
Name=STRING|"Else"

Oleg Yershov
Post Reply