Writing to only empty cells in Excel

Hi

I am currently building a bot that has multiple IF statements, depending on which path of the IF statement the bot goes down it will write in an excel sheet whether the file number (In Cell A2) failed or was successful (into Cell B2) e.g.

Cell A1 /// Cell B1
File Number /// Status - These are headings found in A1/B1
Cell A2 /// Cell B2 - This is data from uipath in A2/B2
123 /// Successful

Hope the above example makes sense, anyway this process will repeat many times for the file number, how do i make UiPath write in the next available EMPTY row? so in this example it would move to A3/B3 etc etc

Usually we use loops for this, but it will depend on your process… While, Do While, For Each…

Can you explain or show me how if you dont mind please?

My workflow would be quite simple its an IF statement
THEN = -File Number- xxx (column a) -status- successful (column b)
ELSE = -File Number- xxx (column a) -status- Failed (column b)

Where the data is coming from? How the IF decides what to do?

Hi @Adeel_Ahmed

Based on an if condition give the condition in then use an assign activity =row(“Status”)=“Success” in else use row(“Status”)=“Fail”

Thanks
Ashwin S

Sorry i may have confused you a bit from my last post, if it goes to then, then i want it to write in the next available empty row in the excel sheet the file number and its status as successful
If it goes to ELSE then it writes in that excel documents next empty row - file number and then failed

The file number should always be in the A column and status should always be in the b column

The file number is generated from a piece of software that the bot scrapes and stores into a variable, the status will be inserted by uipath automatically depending on which path of the IF statement it uses e.g. by using write cell.

The IF is decided by a an image exists so it goes
Image exists

Variable = true (if it is a match then it goes to then, if it isn’t an exact match it goes to fail)

So first it will go to this software get that variable, then go to excel and always start a new excel file? If it is always new, then create a variable (varCounter) of type Integer = 1. every time the process goes to that software and write in excel you will use as cell something like this: “C”+varCounter.ToString

No so the excel file is created at the start of the process, it has the two headings file number and status

The Item number will be found from the software and then stored in a variable which i have working.

There are multiple item numbers to go through which the bot does already and at the end of each item numbers process it will write whether it failed or succeeded into excel so it will record the item number into a variable which is written into column A (an empty cell) and depending on what happens it will write failed or succesful next to the item numbers cell.

I have the write cell functionality done but it currently only writes into “A2” and “B2” i need it to write in the next empty cell below so it should check if the cell it is writing in its proper column is empty…

Attached is the excel file File.xlsx (6.0 KB)

your excel is empty…

File.xlsx (8.3 KB)

Not sure what happened, please try now.

well, you can do as i said before… you must already have some loop that goes to that software to get the numbers…