How to select a particular row and get the value of the row in a particular column

excel

#1

I have this excel file that looks like below. I would like to filter and get this particular row which contains (Weekly/MonthlyFile) and the value in the row of the 3rd column (It has a header not shown below but named ‘amount’). In the end i shud get the value ‘111’. How can i go about doing this? Without hardcoding like the row number as the row isnt constant

Book1.xlsx (10.9 KB)

Thank you xoxo


#2

step 1. Read the excel file and put output in a DataTable type variable dt.
step 2. read “dt.Rows(8)(2).ToString


#3

@reyaz Yes yours work but its too hardcoded. The row isn’t constant. It will change…


#4

You can use For Each Row Activity to iterate through all rows


#5

Use This WoflowMain (7).xaml (8.9 KB)

Regards


#6

ye, but how to specify the row and the column name


#7

Hi @sangasangasanga,

dt.Rows(RowNumber)("ColumnName").ToString

Else Use For each row activity inside you can use
row("ColumnName").ToString()

Regards,
Arivu


#8

you can use column index instead of Column Name


#9

@arivu96 Yes but the rownumber isn’t constant thus i cannot use that way. For for each activity, It will get all the rows. I only want that one particular row


#10

@sangasangasanga, Yes, but you can access that value.

So how you want the output?
Expected Output?


#11

Use Filter Data Table Activity to get one or specific rows


#12

@reyaz @arivu96 @Himanshu.joshi Hi I have edited my question. I changed the format abit. I have to search in the second column for the string that contains ‘(Weekly/MonthlyFile)’ as a substring
Main (7).xaml (9.9 KB)

However, this line does not do that.
row(1).ToString.Select("Date LIKE %(Weekly/MonthlyFile)% “)
nor
Dt.Select(” Date = * (Weekly/MonthlyFile) * " )


#13

Hi @sangasangasanga,

use the below code to get only Weekly/MonthlyFile string contains the value alone.
Dt=Dt.Select("Column1 like '%(Weekly/MonthlyFile)%'").CopyToDataTable()

else

Use For Each Row
Input Dt

use if condition

row(1).ToString().Contains("(Weekly/MonthlyFile)")
If True-> value available in the row
Else -> value not available.

Regards,
Arivu


#14

@arivu96 Your solution works. But it is not ‘Weekly/MonthlyFile’ is not the only value. It has some value after it. Because the code looks for the exact value of ‘Weekly/MonthlyFile’ which is not found in the rows


#15

it will work bro i have used % after that string also so it will return the value.

Regards,
Arivu


#16

Main (7).xaml (12.6 KB)

But it doesn’t bro. Idk why…

is it because using read csv differs from reading excel


#17

HI @sangasangasanga,
Main (7) (1).xaml (12.9 KB)

i have updated the xaml file please check it

Regards,
Arivu


#18

The output is all ‘no’ even tho the string exists

image


#19

Hi @sangasangasanga,

In Read CSV activity read only the first sheet alone.

use excel application scope, please find the xaml file
Main (7) (1).xaml (15.5 KB)

Regards,
Arivu


#20

Hi, i couldn’t upload my csv.file It says ‘Sorry, the file you are trying to upload is not authorized (authorized extensions: jpg, jpeg, png, gif, xaml, nupkg, cs, zip, json, pdf, html, xls, xlsx, xml, vb).’
It looks like this

Downloads.zip (2.8 KB)