Delete Sheet Item

Hello,

I have a excel file with Sheet1 that contains data .
If the Status column value is No then i want to delete those row data from the Sheet1.

Additionaly Can we delete the whole sheet 1 data?

Hi @Shivam_Rana

Yes you can delete the entire sheet if you required by using delete sheet activity.

and if you wanted to delete by row then

1.Read the entire sheet and store it in a variable.
2.Use the for each row in data table and pass the variable.
3.in that for each row in data table activity use the if condition and the condition should be like CurrentRow("Status Column").ToString.Contains("No")
4.In Then sequence use the delete row activity so that the row can be deleted.

Regards

Regards

Hi @Shivam_Rana
Based on the if
Currentrow(“Status”).tostring=“No”

To delete the sheet
Use Delete Sheet activity

Hope it helps!!

Hi @Shivam_Rana

Try like this

Hey @Shivam_Rana , You can delete a row by using delete row activity. First use if condition to check if the particular value is no and then delete that row using the afore mentioned activity.

To delete entire excel sheet, use the delete Sheet activity.
image

Can we do that without using modern activities

@Shivam_Rana

Read the excel using Read workbook range

Take For each row in datatable

CurrentRow(“Status”).ToString.Contains(“No”)

Then

Remove Datarow

Yes,By using the excel activities.
We can do that

image
Use Delete Rows to delete

@Shivam_Rana

yes you can achieve the same output by using the classic activities.

Hope it works!!

@Shivam_Rana

You have delete range in classic activities which you can use to delete any row that you need…read the data loop through and check which has no and pass the index

and for delete sheet we dont have an activity…instead we have copy sheet where we can copy all the remaining sheets to new workbook and create same one without the sheet to be delete

cheers

getting error on on for each row: Collection was modified, enumeration operation might not execute.

Hi @Shivam_Rana

In Classic try this

what should i put in delete range activity range?

@Shivam_Rana

Can you send the screenshot of that error.

Regards

@Shivam_Rana

You can give the index of the for loop where the condition of NO is satisifed

index.ToString + ":" + index.ToString

cheers

@Shivam_Rana

Have you used for each row in datatable only?

Regards

yes, i have implemented the same flow as suggested by you

Can anyone help me out?