Excel Write Cell

I’m trying to write cell to a specific column where the header matches a specific value. How do I find out the alphabet of the column to assign to a variable if the header is subjected to shift?

I’m currently using Excel Application Scope and its’ relevant activities. Can’t use Use Excel File and its’ relevant activities as they are not compatible and switching out the activities would mean change roughly 70% of the script.

Thank you for your advice in advance.

Have a view in this knowledge base to know more about column and indenturing it’s index or name

It’s in point 5

Hope this helps

Cheers @QTH

Hi @QTH ,
You can get by index of cell:
UiPath.Excel.Helpers.ExcelUtilities.ConvertColumnIndexToColumnLetter(ColumnIndex)+RowIndex.ToString
regards,

Thanks for the prompt response. Would like to ask about the solution you provided which has minor changes necessary if the column index is double character. As there’s uncertainty where the header could be, I’m trying to best figure out how to get the correct return regardless if the header in in which setting(single char index or double char index). Would you be able to advise?

Thank you.

1 Like

I think that is also addressed there in the same post for multi characters

For AA1, AA2, AA3,……

Same with a little change in expression

Convert.ToChar( (65 + dt.Columns.IndexOf("Columnname") ) - 26).ToString + (dt.Rows.IndexOf(CurrentRow)+2).ToString

(Output will be “AA1”, “AA2”,…. String type)

Basically if u r uncertain about the position read it as a datatable and parse through or loop through certain key values and get the corresponding column position
With that u can formulate the column name and index position

Hope this helps

Cheers @QTH

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.