Write just selected cloumns of datatable back to excel sheet

Hey,

I have excel with fews cloumns where last two columns are empty, using read range activity i will read that excel storing it in datatable after all the validations i got values for last two columns so i need to write just last two columns back to same excel.
Help me to achieve this

Hi

Welcome to uipath forum

In that case we can just use WRITE RANGE activity from excel or workbook activities

The reason is even if you add more rows or columns when compared to the current one
It will just overwrite on it if we use WRITE RANGE activity

Once you are done the validation mention the datatable dt as input as mention the cell range as “A1” or the cell where you want

and it will over write

Hope this would help you

Cheers @anishakotian400

dtSmall = yourDataTable.DefaultView.toTable(False, {“ColX”,“ColY”})
X,Y name of the last two cols
use dtSmall for write range with an offset in the Range to eg. 5th Col with E1
E = 5 Because of A,B,C,D, E