Extract datatable excel

Hello friends,
@rkelchuri, @Ninett_Panfir, @Rammohan91, @balupad14, @Florent_Salendres, @vvaidya, @Palaniyappan, @ClaytonM, @vvaidya, @lakshman, @Dave,

I need to extract the datatable which starts from the column named “Fornitore”.
The position of the table may be not fixed.
How to extract the datatable adn filter only the rows hich have “Codice CIG” column with a value?
image
prova.xlsx (46.5 KB)

Thank you so much,
Cami

1 Like

Fine
we can start reading the excel with read range activity with range mentioned as “A6” and make sure that the Add headers property is enabled
if the table position is not stable
then read the whole table with add headers property disabled and get the output with a variable of type datatable named outdt
–now use a for each row loop and pass the above variable as input,
–inside the loop use the if condition and mention like this
row(0).ToString.Equals(“Forniture”)
if true it will go to THEN part where we can have our sequence of retrieving the data from the datatable else it will go to ELSE part where we can leave it empty so that nothing will happen for those rows (above the row having value “Fornitore”)

make sure that we can use only column index and not columnname as we have disabled the add headers property in the read range activity

hope this would help you
Cheers @CamiCat

Thank you so much @Palaniyappan.
Can you please share a xaml?
Thank you,
Cami

1 Like

sure
here you go with a xaml
camiprocess.zip (35.3 KB)

hope this would help you
Cheers @CamiCat

1 Like

Thank you so much @Palaniyappan.
I’ll try and let you know.
Camilla

1 Like

sure
Cheers @CamiCat

Hello @Palaniyappan,
I would like to maintain the name of the the columns.


How is it possile to maintain the headers in the Datatable ?
Cami

Fine
is the ADD HEADERS property is enabled while reading with read range activity
Cheers @CamiCat


I’m getting Column1, Column2,…
not Fornitore, Descrizione fornitore…
How ?
Thank you so much @Palaniyappan,
cami

if possible can i see the property panel of read range activity with a screenshot
Cheers @CamiCat

1 Like

Fine
in read range activity activity mention the range as “A6” as Fornitore lies in 6th row of the excel
cheers @CamiCat

Thank you @Palaniyappan but I don’t know the position of the word “Fornitore”.
It is not fixed.

Can you please help me?

1 Like

Fine
lets do one thing
–first use a read range with add headers property disabled, range as “” and get the output with a variable of type datatable named dt
–now use a for each row loop and pass the variable dt as input
–inside the loop use the if condition and mention like this
row(0).tostring.Contains(“Fornitore”)
if this is true it will go to THEN part where we can get the row index like this with a assign activity
int_index = dt.Rows.IndexOf(row)+1

where int_index is a int32 variable

–now next to this for each row loop activity use a READ RANGE ACTIVITY again and add headers property enabled this time with range as
“A”+int_index.ToString
and get the output with a variable of type datatable named Finaldt

–now this Finaldt will have the datatable with headers

hope this would help you
Cheers @CamiCat

Thank you @Palaniyappan.
I’m trying.
How to filter a column so that the date inside "Data fine validità"is less than today?


Cami