I want to read the cell value from the excel sheet and append it to a word file. The values of the sheet will be dynamically growing. Our program should identify the last row and print all the elements in the columns. Please help me.
While reading Excel file using Excel Application scope, UiPath will manage this, so dont have to worry about the last row,
So to find the last row in excel, you can use the read range activity, and then with the datatable you can use Datatable.Rows.Count.ToString to find the position of the last row. (Or as I’ve just noticed, you can use the ‘Get last Row’ activity in the Excel extension…probably easier
To append to word, there is a word activity package you can download called ‘Uipath.Word.Activities’, which will give you the append text activity.
When you have both of these, I used a for each loop, where for each column in Datatable.Columns (TypeArguement is System.Data.DataColumn), I would use the ‘get row item’ activity, and pass it my column loop index, as well as the last row ‘DataTable((Datatable.Rows.Count)-1)’, and this will output that cell value as a GenericValue, which can then be appended to the word doc!
I understand this can get confusing to read so I’ve uploaded a workflow doing what I’ve talked about.Main.xaml (9.8 KB)
Hope this helps!