UiPath taking last row in Excel, should be taking first?

excel
activities

#1

Hi All,

I’m having an issue where UiPath is taking the last row my Excel file, but I need it to take the first row. I have made each column a variable as shown in the pictures below.

In my example, when I call on a variable I am given the values from row 10 instead of row 2 from my excel file. Any suggestions?!

Thank you in advance!
Tanner




#2

Hi @TSummers1,

In your Read Range activity is the property Range empty?

If it’s not empty, it will start reading from the range specified and if it’s empty it will read from the beginning of the excel sheet.

For example:
image


#3

Hi @acaciomelo,

Thanks for the response. I tried making the range empty and still get the same results. Any other trouble shooting ideas?


#4

Hi @TSummers1,

Could you please share a screenshot of your Read Range activity properties and also from your Excel Application Scope?


#5


#6

Hi @TSummers1,

I don’t why this is happening, but one more thing that you could possible do is to assign your mydata Datatable to something like this:

mydata = mydata.AsEnumerable.OrderBy(Function(x) CInt(x.Item("Client Account Number").ToString)).CopyToDataTable

It will order your rows accordingly.


#7

Put the writing part inside foreach loop. It looks like you’re running through all rows first and only when that completes start writing.
If that doesnt work please attach your workflow.


#8

Hi @andrzej.kniola,

I tried that and was unsuccessful. I do believe that it the bot is running through all columns and rows though. I have attached my workflow - thanks for your help!

Main.xaml (62.1 KB)


Read row in excel, set columns to variabels
#9

Hi @TSummers1,

I have checked your workflow and I could see that the sequences responsible to insert the information into your application is not inside the For Each row activity. Please make this changes and test it again.


#10

Hi @acaciomelo,

I just inputted the code you mentioned above into my For Each Row.

Apologies, but can you explain a little more? The sequences responsible for inserting my variables are in “Input Account Numbers” (Account), “Click Method Type” (Type), “Click Account Number” (AccountToTransferTo).

Main.xaml (35.1 KB)


#11

Hi @TSummers1,

Just try to do this:

Select the following sequences in your artifact by pressing CTRL + Click
Input Account Number in MM
Click ‘SUBMIT’ button
Click “Method” Type
Click “Account Number”

And move them to the Body sequence inside the Assign Variables to Columns - For Each Row activity by pressing CTRL + X and CTRL + V.

It would be something like this:


#12

Thanks @acaciomelo, worked perfectly. I didn’t know I had to capture those sequences inside my For Each Row activity.

Thanks again for helping me out.


#13

You are welcome @TSummers1.

Actually it was @andrzej.kniola that came up with this idea. I couldn’t see what was the real problem before him mentioning that :slight_smile:


#14

Thank you for your help @andrzej.kniola! Worked perfectly.


#15

One last question, this bot seems to be taking a long time to process for only going through cells A1:E10 (45 cells). Can you think of anyway to decrease process time?

I figured by describing the range it would make the process faster, but that does not seem to be the case.

image