Storing Code in Excel


#1

Hi all,

Is there a way to store some lines of code in Excel and then execute that code in UiPath via a variable?

For example:

Variable1 = Variable2.Split({vbCrLf},2,StringSplitOptions.RemoveEmptyEntries)(1).Split({" "},5,StringSplitOptions.RemoveEmptyEntries)(4)

I can get it working when assigning a default value to Variable1 within the variables panel. But when attempting to do the same via an Excel cell, it returns the code as a string, rather than executing the code?

Thanks in advance…

Regards,
Dan


#2

I was also interested in this. I know Eval(“string”) or Evaluate(“string”) is what you need but it’s not available in UiPath in that way.

I guess you could just execute your code from within UiPath or within Excel via formulas/vba to return the result to pass it to or from Excel. Unless there’s a really good reason to be passing the code around as a string.


#3

@ClaytonM yes, I also stumbled across the Eval(variable) function & thought I’d solved it… but doesn’t seem to work, as you said.

Frustrating thing is that I can execute just fine via a variable default, as per this screenshot:

Just need that same code to come from Excel, instead of the variable default…

@aksh1yadav @andrzej.kniola do you guys have any thoughts?

Regards,
Dan