Delete Excel data

Hello Friends,

i’m trying to delete xlsx cell datat using write cell (workbook activity) as showen below:

but i had the following error:

Index was out of range. Must be non-negative and less than the size of the collection.Parameter name: index

what could be the reason for that

Hello @abdel,

The error is because you are trying to get the more number of rows than the datatable have which is not possible hence you are getting the error as index out of bound or range, buy using the method dt.Rows.Count you can get how many number of rows are there in that datatable.

Thanks,
Sanjit

Hello @abdel
write cell actvity should give only one cell name like "AL"+(dashboard_DT.Rows.Count+2).Tostring

@abdel If you need to do for above range, use write range activity

can you explaine please how to do that ?

Will you provide a sample input file and which rows need to delete?

Use Delete range activity within Excel scope
Before deleting, Read the required file and store DT

sample.xlsx (47.1 KB)
here it is

@abdel
kindly Refer this
There are 2 duplicate columns, I just renamed it by adding 01 at end of the column name.
Because Read range will throw error while there is Duplicate column
Forum_DeleteRange.zip (102.6 KB)
r

Hello @Gokul_Jayakumar ,

I dcan’t use application scope (only workbook activities) that’s the point

Is there any specific reason to not use Scope?

@Gokul_Jayakumar for security reason the company will not install office in the VMs in fact

Ok, let me update the flow and let you know

@abdel
Kindly check with this updated code
there is 2 flow DeleteRange1 and DeleteRange2. Utilize which can suitable for you
Forum_DeleteRange.zip (160.6 KB)

@Gokul_Jayakumar thank you, but it is very slow: 1 minute to delete 37 row !!

If we use without excel scope, it will happen
Kindly refer DeleteRange2. Its fast method