Get Column Index Number

Hello Friends,

I have Column M1 or Say M, I need “13” as number for it, can anyone help how can I get this.

Thanks in Advance

Hi @Pramod_Bharat_Mangale

Try this expression

Dt.AsEnumerable().Where(Function(w) w.ItemArray.Contains("13")).Select(Function(s) Dt.Rows.IndexOf(s)).First()
DT.Columns.IndexOf(“ColumnName”).ToString

If possible can you share the sample Input and expected output

Regards
Gokul

Hi @Pramod_Bharat_Mangale ,

Do you want to rename the column from text to number?

Kind Regards,
Ashwin A.K

Yes, You Correct

Then could you try this?

image

dt.Columns(ColumnNameOrIndex).ColumnName = "13"

Kind Regards,
Ashwin A.K

HI @Pramod_Bharat_Mangale

Try this

Uipath.Excel.Helpers.ExcelUtilities.ConvertColumnLetterToColumnIndex(“M”)
image

Hope this Helps

Regards
Sudharsan

grafik

 UiPath.Excel.Helpers.ExcelUtilities.ConvertColumnLetterToColumnIndex("M")
 13
 UiPath.Excel.Helpers.ExcelUtilities.ConvertColumnIndexToColumnLetter(13)
 "M"
 UiPath.Excel.Helpers.ExcelUtilities.ConvertColumnLetterToColumnIndex("AA")
 27
 UiPath.Excel.Helpers.ExcelUtilities.ConvertColumnIndexToColumnLetter(27)
 "AA"

@Pramod_Bharat_Mangale If you have like M1 try this

Uipath.Excel.Helpers.ExcelUtilities.ConvertColumnLetterToColumnIndex(System.Text.RegularExpressions.Regex.Match(“M1”,“\D+”).ToString)

Regards
Sudharsan

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