Using retrieved excel data for use as expression in Studio

Hi, I have setup a config file stored in excel. I am able to retrieve the values from the excel file as a string into UiPath Studio. However i wish to use the retrieved value not as a string but as an input into a webpage.

For eg. my retrieved string value from excel is as below:

CurrentRow(“XXX”).ToString+" is returned."+Environment.Newline

I wish to use this inside UiPath as in an input to the webpage, however it will simply print it on the screen as is of the whole string. However, i want to it to be a with the value of CurrentRow(“XXX”).ToString + a newline to be used within UiPath in further steps. How do i convert the string to that?

Thank you for your help!

Hi @stareast

Try this:

message = CurrentRow(“XXX”).ToString + " is returned." + Environment.NewLine

message = message.Replace(Environment.NewLine, vbNewLine)

Use this modified message in your input field

@stareast

CurrentRow("XXX").ToString + " is returned." + Environment.NewLine

@stareast
Use an “Assign” activity to format the string. You can concatenate the value with the desired text and newline character.
formattedValue = CurrentRow(“XXX”).ToString + " is returned." + Environment.NewLine

Thanks I have tried but i got the same thing back

Hi, the issue is the value of each retrieved excel data is different to set as config and it will not be easy for me to customise every output from the retrieved string into the native variable to be used by UiPath

Hi @stareast

Do you want to use the Excel file as Config File, that If you call the Key name then you want to get the value of it?

If your question is not relatable to above, then elaborate your query more for better understanding.

Hi, yes my config file was stored in excel, i am able to retrieve it into a datatable and converted to stored into dictionary where i call the Key name and i get the value. All of this works fine, its just that for now the value i retrieved is purely a string and i am not sure how to use it back within UiPath for further processing. For eg. “CurrentRow(“XXX”).ToString” does refer to other values within UiPath in further steps but when i retrieved this value as a string, how do i convert it to be use inside UiPath further steps rather than it being a string of “CurrentRow(“XXX”).ToString”?

I want it to be used in the form below
image

but UiPath is taking it as a full string displaying on logfile and webpage input as “CurrentRow(“XXX”).ToString+” is returned.“+Environment.Newline”

Try to debug the code and make a breakpoint at this activity and check the what is the value in the CurrentRow(“XXX”).ToString.

Check this and send me the screenshot of immediate panel.

Hope you understand!!

I have added a writeline to display CurrentRow(“XXX”).ToString when keyed in directly:

image

Okay @stareast

Then it was working perfect right, then what is the main problem you are facing.

Below is when i key in directly to write line: CurrentRow(“Ref No”).ToString+" is returned for amendment."+Environment.Newline+

image

Below is what i retrieved from my excel->datatable->dict value and to write line.
image

Hi, @stareast why are you using a dictionary for this? You can store it directly into an String variable with an assign (or multiple assign) that you can use in an type into activity.

Instead of converting the excel to datatable, use the excel activities directly.
To iterate the each row in the excel, use the For each excel row activity.

Hope you understand!!

have tried it. may i know whats the difference? its giving me the same thing

Hi, even when i use for each excel row and extract directly and for eg use the output to type into a browser, it gives me the same kind of output with the +Envionment.Newline+

i found similar question in Storing Code in Excel - #3 by dlp1980 but no avail answer

HI, but didn’t you have a datatable already? I have to extract data from excel files all the time in my job and the way I do it is by building a datatable by using an excel application scope + use axcel file + read range and with that read range you have an datatable that you than can use in an for each row in datatable activity and place the values that value in an variable with an assign. Do you use queue items or do you have to extract it and place it directly into your browser application/site?