How to delete the multiple columns in excel if the value is zero

Hi,

How to delete the entire column in excel if the value is zero. The column will be dynamic always and it will be multiple columns.Please suggest. Im using UIpath community version. Attached the excel for exampleFilterColumnwithZeroinExcel.xlsx (8.3 KB)

@asatheeshk21
First using Read range activity read excel file and store in datatable.
After that use FOR EACH ROW in that datatable and then in it for each activty for columns in that datatable.
Then in nested for each use if condition columnValue.Tostring = β€œ0” True Then use delete column activity and pass that dataColumn in it.

it will work for all dynamic rows and columns in datatable

After in end use write range to write data in excel.

Cheers @asatheeshk21

3 Likes

Hi @asatheeshk21

Try this

Thanks
Ashwin S

@asatheeshk21

Below is the working for above:
image

Hope it will work!!

Cheers @asatheeshk21

Hi,

Im new to RPA Uipath,
You have mentioned below comment.
β€œThen in nested for each use if condition columnValue.Tostring = β€œ0” True Then use delete column activity and pass that dataColumn in it.”

Can you pls tell me what needs to be given in delete column table name and column name.

HI Paras,

I will be helpful if you could share the xaml for the given excel provided. FilterColumnwithZeroinExcel.xlsx (8.3 KB)

1 Like

@asatheeshk21

Please go through with this:

Main.xaml (6.7 KB)

Cheers @asatheeshk21

Still its not working. I have attached the xaml file and excel file. Can you pls suggesttest Report.xlsx (9.8 KB) FindValueInExcel.xaml (11.3 KB)

@asatheeshk21
Remove 0 in excel:

Get the output sheet as sheet 2 in below excel:
Also find attached workflow in it:

test Report (1).xlsx (10.4 KB) FindValueInExcel.xaml (10.6 KB)

Hope it will work for you if it please mark as solution.

Thanks & Regards,
Paras

Hi Paras,

Thanks for the response, My requirement is to delete the entire column whichever is having the value of zero.The output should like sheet 2 attached herewithtest Report (1).xlsx (10.8 KB)

If there is any one non zero then only whole column value should be there if not then whole column will be deleted.

@asatheeshk21
Please go through with this, It gives expected result in sheet3 as you want:

Main.xaml (7.5 KB)

test Report (1).xlsx (11.4 KB)

Hope it will work for you!!
Cheers @asatheeshk21

2 Likes

@asatheeshk21
As I can understand the requirement here.
Requirement-
If any column value is zero then that column should be deleted and the one who is having value should be remained.
sheet 2 - output required.
sheet 1 - test Data.

Please correct me if I am wrong.

@ParasTripathi
Thanks.
Jun column should also be available there in sheet 3 as jun column value having data in it.
Please correct me if i am wrong

2 Likes

@Abhishek_Kumar_sinha

Please look what he want:

Thanks @Abhishek_Kumar_sinha

2 Likes

Hi Paras,

Still i didnt get the expected result in the xaml file which you shared. PFA the xaml which im using which you shared previously. Kindly suggestFindValueInExcel (1).xaml (10.4 KB)

1 Like

@asatheeshk21

Please go through with this I Think i have posted wrong xaml file.

FindValueInExcel-Paras.xaml (10.7 KB)

Thanks & Regards,
Paras

1 Like

Hi Paras,

Sorry I think you didnt used my latest sheet after i edited.Please refer sheet2. Now june month is missing in the latest. Kindly suggesttest Report (1).xlsx (10.8 KB)

Okay @asatheeshk21

Please go through with this it is resolved your problem:

test Report (1).xlsx (10.8 KB) FindValueInExcel-Paras.xaml (14.2 KB)

Hope finally it gives you as expected result!!

Cheers @asatheeshk21

2 Likes

Thanks alot Paras. It worked :slight_smile:

1 Like

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