How to write to next empty cell on excel?

Hi all, I am looking to write a URL that I get from a website to the next empty cell in a column on excel. I have the below formula however this overwrites the URL from the second cellonwards,

Any guidance is appreciated!

@mmishal001 Are you checking if the Cell is empty or not , then assigning a value into it ?

Hi @mmishal001

I guess the excelRow variable points to the last row instead of the next available row. What if you increment the variable by one before you do the write cell activity?

Could you pls guide me on how I can check if cell is empty and then write to it?

Hi @Lahiru.Fernando the excelRow variable points to the first rows and then increments by one to write to the next cell.

I need an activity / formula that writes to the next empty cell in the same column. would you now how I can achieve this?

We can find the number of rows of the excel file by doing a read range.

Once you do, if you have the add headers option enabled in read range, add 1 to the row count you get from the below code

Get row count
DatatableVariable.Rows.Count

Add 1 to this based on my explanation above.

Now, add another 1 to get the next row. This will be your next available row :slight_smile:

You can loop this part to get the next available row for each run

Now, add another 1 to get the next row. This will be your next available row :slight_smile:

Make sense?

Use the below method

Read cell to get the value to a string variable

Now use if condition

If String.IsNullOrEmpty(CellValue)

1 Like