If you are trying this with Excel activities then use Read Range activity inside Excel Scope this will give you DataTable.
intLastColumn = dtExcel.Columns.Count+1
This will give you last column.
Use this code to get column letter.
strColLetter = UiPath.Excel.Helpers.ExcelUtilities.ConvertColumnIndexToColumnLetter(intLastColumn )
Column header cell
strCell = strColLetter +"1"
Rest data you can write by changing the row number as per your logic.
like strColLetter +"2"
strColLetter +"3"
etc.
Thanks,
Ashok