Plz solovemy issues

i have an excel file… and i have a string on “AJ” coloums
i want that coloumns index nummber how can i find that index number
New Microsoft Excel Worksheet.xlsx (8.6 KB)

Hi @katta_nikhil ,

You can refer to the balareva easy excel custom package by @balupad14 :

It has find activity which provides the index after finding the given text.

Regards,

1 Like

is there any other approach to find the index number for that particular coloumn

HI @vishal.kp ,

Take a look at these.

Regards
Balamurugan.S

Hi @katta_nikhil ,

Here, the condition is not properly shown or provided to us.

Do you want to search for the column name ? or a value in any of the columns and you would want to know to which column it belongs ?

If it is the column name that you are trying to find and then get it’s column Index, maybe you could check the below :

DT1.Columns.IndexOf(DT1.Columns("nikhil"))

image

Now, If the string is value in one of the columns, then we can use the below Expression :

DT1.AsEnumerable.Select(Function(x)Array.IndexOf(x.ItemArray,"nikhil")).SkipWhile(Function(x)x=-1).First

image

2 Likes

iam not able to install this dependency

@katta_nikhil

You can first use find/replace activity which would give you the cell name of excel then we can convert it to index using below expression

UiPath.Excel.Helpers.ExcelUtilities.ConvertColumnLetterToIndex(VarCellName)

You can extract column name using the cell address output

System.Text.regularExpressions.regex.Match(celladdress,"[A-Z]+").Value

You can pass any column name of excel like AF and it would give the index of it

Cheers

Hello @katta_nikhil
Refer to this xaml file you may get some idea.
ForumColumnIndex.zip (148.1 KB)
Step

  1. Use Excel application scope and indiacte the file path
  2. Use the Lookup range in it and get output as a string of its position in Excel like “AJ1” store in variable Position.
  3. Use regex to separate the column Name
Position= System.Text.RegularExpressions.Regex.Match(Position,"\D+").ToString.Trim   ----> AJ
  1. Use the UiPath Excel expression to convert the alphabet to the index number.
UiPath.Excel.Helpers.ExcelUtilities.ConvertColumnLetterToColumnIndex(Position)    ----->36

1 Like

Hi Nikhil,

Here we go i have attached sample workflow…

Column INdex.zip (8.6 KB)

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