Support Portal

for ProcessRobot and WinAutomation

Start a new topic
Answered

get a path from a datarow

Hi, I'm trying to get a path (for open a new file) from a cell in an excel worksheet, when I try to open a new excel passing the parameter %DataTable[1]% and i try to run the process i get the next error:


Runtime Error: Wrong value passed into <Document Path> property. Cannot convert a DataRow into a File


so, is there a way to do this?


thanks for the help


Best Answer

it is also better practice to always specify both the row and column of the cell, as below, instead of having it implicitly default to row index 0, because you only specified 1 coordinate of the 2 dimensional datatable variable


%ExcelData[0][1]%


If you only want to grab the contents of a cell you can use Read from Excel Worksheet.


This will store the value in a text variable. Add this variable to the application path on Run Application action and done.


Are you checking wha'ts the value of %DataTable[1]%?

I'm reading 5 cells because of that I'm using DataTable, and using a Display Massage i can get the value of the cell and is the correct path. Thanks for your answer if I don't get another solution i will read the cells one by one

It should work with your range. Could you try to create a sample project with your cells and just 3 actions?


- launch excel

- read from excel (with your range)

- display or run application with your %ExcelData[1]% variable.

display de value works well (using a display message control), using the value for open a file doesn't work.  The solution i found was copying the value "ExcelData[1]" to the clipboard  and then get the value again to open the new excel file. but I'm not sure if this is the correct form to do it

you must have a line feed character or tab character in the cell  ----- trim the whitespace before and after with trim action


trim %ExcelData[1]% 



Answer

it is also better practice to always specify both the row and column of the cell, as below, instead of having it implicitly default to row index 0, because you only specified 1 coordinate of the 2 dimensional datatable variable


%ExcelData[0][1]%

thank you, it works

Login or Signup to post a comment