Writing cells in excel

How do i write to a cell in excel, while checking if its empty. If its empty, then write to that cell, if not, go to the row below and write to that cell instead.

For example, I want to start at cell G2. Check if G2 is empty, if it is empty i will write “Done”, if its not empty, i go to cell G3 and check if its empty…

@yang.keat.tan

Use for each row in excel cell activity and give the range as Excel.Sheet("SheetName").Range("G2:G100")

Inside the loop use if condition with currentRow.ByIndex(0).Value.ToString.Trim.Equals("")

And on then side use write cell with currentRow.ByIndex(0).Cell and give value as "Done" and then use a break statement as the required row is found

G2:G100 can be made as variable depending on what column you need and what range you want to search

Cheers

Hi,

Can you try the following sample?

Sample202306298-5.zip (9.6 KB)

Regards,