Excel Modern Activity-get sheet

Good day,
I have studio 2025, and would like to use modern activities to check if the sheet name exists in the excel file. I have some activities I have used for it but the issue is excel stays open then when it gets to Read range activity it errors because of that open file. Is there a way to check for an existing sheet and also to write onto the excel file column in the background..

These are the activities used:



@Anelisa_Bolosha1
Hi, If your excel remains open after getting sheets, You can Kill Process activity to kill the excel process. It will close it and you can read it.

Hi @Anelisa_Bolosha1

Yes, you can simplify it with Modern Excel activities:

Excel File → Check if Sheet Exists → If True → Read Range

Keep the sheet name in a variable, e.g. sheetName = “Fail”, and check it before reading.

This avoids the older Get Workbook Sheet approach.

Hi @Anelisa_Bolosha1 ,
The issue is likely happening because Excel remains attached/open within the Excel Application Scope, so when another activity tries to access the same file, it may encounter a lock.
Try the below steps:

  1. Use Use Excel File activity instead of Excel Application Scope.
  2. Get all sheet names using Get Workbook Sheets.
  3. Check whether the sheet exists:
    sheetNames.Contains(“Fail”)
  4. If the sheet exists, use Read Range and Write Range/Write Cell inside the same Use Excel File container.
  5. Enable Visible = False (or disable opening Excel) to work in the background.

Thanks

Hi @Anelisa_Bolosha1

The Get Workbook Sheets activity is unfortunately not developed as a Modern activity.

You can use the For Each Excel Sheet to loop the sheets and an If activity to check for your condition.

Regards
Soren

Hi @Anelisa_Bolosha1,

You can surround the Read Range activity with a Try Catch block. In the Catch block, handle the System.ArgumentException and check the exception message, which will indicate that the sheet does not exist.

This way, you can handle the missing sheet scenario gracefully instead of letting the workflow fail.

Thanks!

Hi Anelisa_Bolosha1

I think that the issue is that you use an Excel Application Scope which opens the file, then down further down the process you use a Read Range activity that is not meant for the Excel Application Scope. It tries to open the file again - which it can’t because it is already open.

If you in the Activities list in Studio Search for ‘Read Range’ then you should find at least two ‘Read Range’-activities. You should use the on where you don’t have to give the filepath again.

The correct Read Range will not need a filepath because you already gave it in the Excel Application Scope.

Hope this makes sense and helps.
I can make you an example if you need