In my process I draw an Excel file from SAP and if I do it on different days the data changes a little bit. For example on one day it has 300 rows and on the other day it has 1000.
Now I want to add a formula to the last row of the column in the excel sheet. Is there a way to do it? I am not allowed to use any external packages like “BalaReva” whick makes it harder
Hi @urvesh.mistry,
thanks for your answer! I forgot to mention that I need to put the formular below the last row of the excel file. For example the last data is in row 300 and the formula (subtotal) needs to be in row 301.
Do you have an idea?
@urvesh.mistry
Aaaah okay now there is no error. The problem is still that I have to type in the formula in UiPath, basically: (=SUBTOTAL(9;Y2:Ylastrow +1). I don’t know the last row or the range of the column in advance. Do you have a solution for that?
I did the way you wrote, but it only calculates the sum of Y2:Y4 but I need the whole column. The formula which stands in the cell (=SUM(Y2:Y4)) will be in Excel too but I need the formula “(=SUBTOTAL(9;Y2:Ylastrowofthecolumn)”. Do you know what I mean?
@RandomGuy - Destrow and Actual rows are Int variable. Since I had 5 rows excluding the header it has the value of 5. Since I need to write the output in the A7 column so i added+2 . I have created one more variable real rows to get Rows.count+1
WriteCell
Output
Working flawlessly.
Here is the xaml and excel file : LINQ.xlsx (8.9 KB) Main.xaml (14.3 KB)
@prasath17
Well that’s what I have now. I deleted the variable which I had in the Assign activity but that is not very relevant I guess. The range has to be in column Y and the formula has to be in its last row. The Subtotal formula needs to know which range it should take. That’s why I have the Y+(dt.Rows.Count+1).ToString+" part. The fun thing is that it works when I change the formula to SUM which doesn’t make sense to me since the range stays the same.
Here is a screenshot: