Getting value from Excel


If I get input value as powerpoint ,i need to get output as PowerPoint.please find the attached photo.

1 Like

Hey @sruthesanju

  1. Read your excel table into a DataTable variable as dt_Config

  2. Assuming your input string variable as inputStringVar

  3. Below is the code to fetch keyword value based on the name column value received in the input string variable

dt_Config.AsEnumerable.Where(Function(row) row("Name").ToString.Equals(inputStringVar)).First().Item("Keyword").ToString.Trim

Hope this helps

Thanks
#nK

If I get any value from keyword column .I need to get value from name column

1 Like

Hey @sruthesanju

Please find the updated one…

dt_Config.AsEnumerable.Where(Function(row) row("Keyword").ToString.Contains(inputStringVar)).First().Item("Name").ToString.Trim

Thanks
#nK

I have tried this one ,I am getting the error as Sequence contains no element

1 Like

It means the input string you passed has no match.

Whats the input value you passed?

#nK

Power Point which is there in keyword column

1 Like

Are you passing the exact word, If you pass with space and different case it will cause issue.

Just updated the statement below to handle spaces and also case insensitive if this is relevant for you

dt_Config.AsEnumerable.Where(Function(row) row("Keyword").ToString.ToLower.Contains(inputStringVar.ToLower.Replace(" ",""))).First().Item("Name").ToString.Trim

Thanks
#nK

1 Like

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