Office 365 Scope - Write Cell within Protected sheet/Excel file (allow ranges)

I have an automation that used to work fine, part of it was to enter an error code into a spreadsheet in sharepoint/Teams when it encountered an issue…

Our finance department wanted to lock down the spreadsheet so that others who had access would not be able to delete rows or change any of the information within the first 3 columns…

I did this with allow edit ranges in the excel file giving permissions to users able to access and edit these cells and deny access to other users etc… The user the Robot signs into sharepoint as was on the full allowance list as it needed to complete these first few columns with its error data… The sheet has to be protected for the allow edit ranges to work…

When i run my process it goes through the office 365 scope, finds the file, reads the range, but when it tries to write cell i am getting a “Write Cell: CodeAccess Denied” error…

When the file is open on the robot PC I can manually enter data into those columns with the Robot User… Is this a “feature” of office 365 scope activities that they don’t work with files that have any kind of protection on them etc…? Is there no way to put in the sheet password as there is in an excel application scope activity…

Am I missing something…? Any help greatly appreciated
Dawn

1 Like

Hey @DawnW

It depends on the Authentication Type you are using.

Kindly make sure the authentication you make from scope belong to the same bot user which has permission.

Also, make sure you enable proper scope resources in the scope activity.

Thanks
#nK

I’m using Application ID and Application Secret within the 365 scope…
These were set up in the azure portal with the ‘Robot’ user as the owner…

1 Like

Okay @DawnW

So that’s the place to check. When we set the App ID and Secret we also provide scope permissions in the console.

Kindly check if necessary permissions are provided for that ID and Secret please.

Thanks
#nK

1 Like

I’m unfortunately not sure where to look or what to edit within the portal…

It’s annoying as it works fine when the excel sheet is not protected, but just will not write when the protection is on, despite it being one of the users allowed to edit everything within the file…

Some more research needed…

1 Like

Hey @DawnW

When you create an App ID and Secret, you are registering a new Application to access the Azure resources programmatically. The permission for the protected sheet has been provided to the user which is completely different from this.

For more info, please refer below blog post which will help you understand.

Thanks
#nK