Get row cell number of first occurrence of a word in excel

Hi All,

I am trying to get the row cell number “Item” in the attached screenshot. There are two occurrences but i’ll like to get the row cell number of the first. The rows are inconsistent so i cant use the specific row number to get “Item”. I tried the below screenshot but it keeps telling me “column invoice does not exist”. What can

i do?

Hi @Olaoluwa_Ogunwa

Create a workflow to have two input arguments as string(one to get file path - inArg1 and other for the search key - inArg2) and an output argument as string (to get the cell address of the search text - outArg3)
Please follow below steps-

  • open the excel file(inArg1) that you want to get index of “item”
  • Click Ctrl + g, opens the Go To dialog.
  • Enter reference value to “A1” and click ok or send HOT key for enter
  • Click Ctrl + f, opens the find window
  • type in the key name you want to search(inArg2) and hit enter
  • now use get text activity pointing to the cell address edit combo box on top left corner and assign it to output argument (outArg3)

<wnd app='excel.exe' cls='XLMAIN' />
<wnd cls='ComboBox' />
<wnd cls='Edit' />

Hope this will be helpful! Please mark solution if this works for you so that people facing similar issues can directly get to the answer.

Hi Madhavi,

Is there a way to do this without opening the spreadsheet? I know to get a column with a specific word one can do this dt.Columns.IndexOf(“Item”).Tostring. Just thinking if theres also a way to do that with Rows.

Thank you

Hi @Olaoluwa_Ogunwa
If the column where the search text will be is static, then you can use read range and read all the data. Use select statement matching the search text in the static column. But if the search text column can vary, then this is not a solution.

dt.Columns.IndexOf(“Item”) checks for a column named item. But here also you should know the range where the data exists. Other wise it will not work.