How to write cell in the next row?

I just want to Get Text(daily stock price) from a web page to an Excel file,
I use Write Cell,but I can only write in a specified range like B2, Is there any way to write it into
next row,I want it keep renewing my excel file without changing the Write Cell range everyday.

Sorry for my poor English expression.

1 Like

@111128 Welcome to UiPath community

Yes you can do by using one counter variable

1 Like

Hi,

Welcome to the community!

To answer your question, we need to get clarification on few things,

  1. Is your process scheduled? if so, one way you can implement this is by reading the excel file before you writing it and appending your new values to the datatable and write it back to the excel sheet.

  2. If the bot is completely dedicated only to this process. you can keep the counter as indra said. But usually this wont be the scenario.

Try and let us know if you need any further help on this.

Best,
Sid

1 Like

@111128 : Take a counter variable and intialize 1 at starting ,after writing the value every time increment the counter.so your value will not get override.

Hope this helps.

Thanks

Thank you for your answering, but I still don’t know how to take a counter variable, use Assign?

can someone show me the screenshot or something that I can learn it clearly,please.

But still thanks, I’m just a student , so forgive me that I’m too stupid to learn…%E6%93%B7%E5%8F%96

You have to use the counter variable at cell position ( where you coded as b2). You have to increment the cell value as b2, b3, b4,… so on. In such case, we need to do the below steps.

  1. we need to declare a counter variable. it is nothing but a variable with datatype int32. let it be, counter.
  2. initialize it to a integer value. You can use assign activity for this. Counter = 1
  3. now you can mention the cell position as “b”+counter.Tostring
  4. increment the counter by 1.
2 Likes

Hi Sarigam your Idea is working but one problem is occurring that it’s writing from line B10 and not B1, Can you please suggest what could be problem behind this, Below are the screen prints,

Excel I am using is,

Getting same issue…please help

@rakeshsingh.rpa
@Devyani_Jadhav

You are incrementing incorrectly.

You have “B1” + Counter.ToString which results in B10
You need to change to “B” + Counter.ToString

Regards

Under write cell u can mention this under range as

“B2:B”+(DT.rows.count+1).Tostring

Try this without the counter variable and check

Just stating this, since a lot of the answers seems to neglect it.
As many have answered before, using a Counter variable could be the way to go.

But instead of creating a whole new variable and keep track of it, initializing it and updating it, just use the build the Index variable of the For Each Row-Loop (but it keep in mind that is starts on 0, not 1).
So in your Row field, use the Counter you assign in the Index-output field, and remember to always add 1 to it :slight_smile:
image