Excel Query Data Remove

My excel is taking 5-6 sec to open as there is huge data. but the last activity I used is Insert/Delete is still executing…

If you see total number of rows are 1221

I put CountRows - 11

@HareeshMR your CountRows-11 is working but deleting rows very slow in 3 min it deleted 4 rows…so you can estimate to delete 1211 how long will it take…

Gettting this error when give the range A12
image

@Palaniyappan @HareeshMR can you please reply…

Fine we can do one thing let’s read the whole table in excel with “” in the range and in the insert delete row activity we can mention the no of rows as outdt.Count-11

Hope That would work
Cheers @balkishan

I did same thing as Hareesh mentioned, It’s working but it’s taking time to delete the row. It deleted the 4 rows in 2 min…forcefully I have to stop this.

Fine may I know how many records are there in the excel and how long it takes to complete
Cheers @balkishan

total 1221 rows bro. and there are multiple sheet in this. I am deleting for specific sheet not for all. But it’s taking time, I already started the process but still it’s executing.
Excel file size is 17 MB

The reason is not because of no of rows in the sheet where we are trying to delete the records and it’s because of the file size and moreover we are using this insert /delete rows inside the excel application and to access that size of file will usually take time buddy
But how long it takes makes the difference
Cheers @balkishan

bro still it’s executing…If I will stop it manually then only I can say how much time it’s taking…

oh
thats strange
then its not a feasible one i guess,
can i have a view on that excel sheet a screenshot if possible
Cheers @balkishan

see it took 5 min to delete these 12 rows…and i have around 1200 rows to be deleted…

So is there any way to do this.

Please reply bro. your both method either I put A12 in Read Range or read the complete sheet both are working but very - 2 slow. In 2 min it deleted 3 rows.

Any other method please let me know bro @Palaniyappan Excel screenshot attached FYI in previous comment.
@HareeshMR

I prefer using code in this type of situations @balkishan

Lets give a try with code as well . But I hope that will work :slight_smile:

which code bro, can you please tell me

Use Invoke code activity, opening the excel and clearing the data @balkishan.

If you are okay with the code, will provide the code . Or will send you the code. Give a try and let me know if that helps

will it clear the data from the 12th row till end. Please send me bro.

Here it is @balkishan

    Dim excel As Microsoft.Office.Interop.Excel.Application
    Dim wb As Microsoft.Office.Interop.Excel.Workbook
    Dim ws As Microsoft.Office.Interop.Excel.Worksheet 
 excel = New Microsoft.Office.Interop.Excel.Application
  wb = excel.Workbooks.Open(inputfolderpath + revenuefile, [ReadOnly]:=False)
    excel.Visible = True

    ws = CType(wb.Sheets("MT"), Microsoft.Office.Interop.Excel.Worksheet) 
    ws.Activate()
    Dim rowCount = ws.UsedRange.Rows.Count
   ws.Range("A12:G" + rowCount.ToString).Clear()
   wb.Save()
    wb.Close()
    excel.Quit()

Try this @balkishan

Is MT is sheet name?

So where I have to use the Invoke code activity, inside the excel scope bro?

No… use it individually and Sheet name and path of excel change it to your file name and sheet name

can you please tell me where I have to give the path, sheet name. and how do you specify the range is it right bro?
I didn’t see any thing where I have to specify the path.