Enter data in last empty row specific to column name

excel

#1

Hi Everyone,

I have few data from one excel ( Used read cell to copy multiple data) now i need to enter the copied data into another excel sheet to last empty row

Ex- Column name is SLI# in that column last empty row i need to enter sliNum which i copied from another excel. likewise i need to enter other datas

i have attached xaml file and excel also for better understanding. SLI.zip (370.7 KB)


#2

Hi.

One method would be to use Read Range of the sheet, then get the .Count which will give you the number of rows and thus the last row number.

dt1.Rows.Count

Regards


#3

Hi Clayton,

That will give only last row number but i need to go to Column B last empty row write the data and then Column C last empty row write data.


#4

Sorry, I thought you had column figured out already.

So, basically you can use the same concept but instead use .IndexOf then convert that number to a character.

Convert.Char(dt1.Columns.IndexOf("SLI#")+65) // change 65 to 64 if it's off by 1

That will cover from A to Z though and if you need AA and on then it will be more complicated but I can provide that if needed.

I will also note that updating this table would be probably easier if you just used the data table from the Read Range, then use Write Range to update the file.
In that case, you could just simply use Assign row("SLI#") = newvalue

Hope that answers it better.

Regards.


#5

Since you’re entering multiple values in the last row, you might want to use the Add Data Row activity after using the Read Range activity to read the dataset into a datatable variable. Then you can use the ArrayRow property (in the Add Data Row activity) to create an array that will populate that last row.


#6

HI Tuanax,

Can you please explain how to give input in ArrayRow ? because i need to enter multiple data.


#7

@Lawrance_A

In Arrayrow property of Add datarow activity give the variables in the order of your columns in dataTable.

Ex.{var1, var2, var3} depends on number of columns in your dataTable


#8

Hi Manju,

I have tried it but am getting output as entire sheet content.
Can you check my syntax ?

i would required to enter sliNum variable to be entered in SLI# column same way for other content.


#9

@Lawrance_A what output ur getting? Is it not add values to last row?


#10

No Its not adding any value


#11

@Lawrance_A Above statement will add values to first and second column. write the dataTable to dummy excel and check for the sliNum and gsbd strings. It will be present in your excel. for less values messages box is useful for large number of values it will be confusing, try write dataTable to excel and check the for those string.
If you want to write the values present in those variables remove double quotes.


#12

Hi Manju,

Your right ! I have tried with write csv of DT its working fine data is entered in last empty row but why its not entering in my master sheet ? do i need to add any activity ?

write%20CSV


#13

I need to enter it in my master sheet.


#14

@Lawrance_A instead of writing to csv u write that dataTable to mastersheet. Since datatable contains same data as mastersheet.


#15

I have used write range and selected sheet name of my master sheet but its throwing exception.

Sorry to ask too many questions, am very new to Uipath.Writerang%20mastersheet


#16

@Lawrance_A give range as “A1” and try once.


#17

Same error existing


#18

@Lawrance_A Open excel sheet, Click on editing and try once. If such option comes for u. And also check for U have permision to edit that excel or not. If above options are working for you, uninstall and install again excel activities and try once.


#19

Hi Manju,

Thanks for your solution. I have solved it. Problem is in Excel sheet. I have created new sheet and its working fine.