Delete Empty Excel in Folder

Hello,

in a folder I have several excel files. Some of them are completely empty as such:

And I cannot even use READ Range to check if empty then delete.
Can someone help how I can do this please?
Thanks!

image

PO Status_20210720064330.xlsx (4.2 KB)

I was getting this error: Object reference not set to an instance of an object.

Hi @Yudhisteer_Chintaram1,

So you get a NullReferenceException. Do mention what kind of error message you get in your question, it helps a lot to resolve an issue in the forum.

All you have to do is to use try-catch activity and look for NullReferenceException type of error.
If the error exists then delete file, if not read the content.


Here is how you can achieve it. Offcourse, you have to adapt it to your scenario:

CheckForEmpySheet.xaml (8.0 KB)

2 Likes

I was getting this: Object reference not set to an instance of an object.

Hi @Yudhisteer_Chintaram1,

That is because you probably forgot to populate the output variable in the read range activity.

That error says that you are trying to get some value without specifying where to save the value. Read range tries to read but then it fails.

Once you fix this you will get the error message which I specify above. Both are solved in the attached workflow above.

See yellow mark:

Hi @Yudhisteer_Chintaram1

Please refer the xaml below.

Main.xaml (9.1 KB)

If the exception occurs it will catch and delete file and move on to next file.

Regards

1 Like

Thnaks!

Thanks!

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