Excel Scope doesn't create New Folder?

Hey guys,

Some odd observations I’ve noticed with Excel Application Scope vs System activities and I wanted some clarification on whether this is correct or not, or if it is a bug within UiPath, or perhaps I’m missing something

For context my robot process; I am checking for lists of Active Directory users in different groups and so I wanted to output all user lists (datatables) as seperate Excel files, each named for the relevant AD group. Even if there are 0 rows/users in the table I wanted to create an empty Excel file anyway with the header row only to confirm that the Group exists but there are no users inside it. These were to be saved into new folder paths if it’s the first time it’s been run. (FYI my robot then compares current users and identifies new/removed/changed users so that’s why I need the header row so my Read Range in future run doesn’t fail and it can pick up any new users)

Something I noticed with doing some isolated testing of the Excel activities with Write Range…

  • If using Excel Application Scope: Write Range, we can output an empty datatable and it will include the Header names only, but it is unable to Create New Folder if the folder doesn’t already exist

  • If using System: Write Range, we can output an empty datatable but it will NOT include the Header names (is a completely empty file), but it does Create New Folder if the folder doesn’t already exist

Is this correct? The only workaround I saw was, to first use Path Exists to check folder exists, if not use Create Folder to create the folder path, THEN use Excel Scope activity to output an empty datatable to include the header names.

Let me know if I’m doing something wrong as well… as you would think this is a common need to automatically create the new folder if it doesn’t already exists AND include the header row even if the datatable is empty

i think you can just use create folder without using path exist, if the folder exist nothing will change, otherwise it will create the folder

Oh good thinking, that might look a bit cleaner

Is this correct however? I would have assumed that the robot would automatically create new folder if it doesn’t already exist, in both System or Application scopes

Hello @Jon_G

it will not create a new folder. but the activity will look into the folder for the existing file. If it is not present , then it will create a new excel file(But not the folder).

So you have to create the Folder using Create folder activity and need to pass the full path to the excel activities.

Otherwise it will throw the error.