Forum Discussion
BradynHin
Jun 02, 2023Copper Contributor
"You cannot perform the requested operation.", code: "AccessDenied", method: "addTable", line: 9}
The following is my code in excel under the automate tab which when ran in a workbook with a sheet called "STU Chassis" regardless of the data contained gives this error {message: "You cannot perform...
SergeiBaklan
Jun 02, 2023Diamond Contributor
Can't reproduce such error, even on protected sheet. If you run on new workbook with such named sheet, do you have an error?
Just in case, slightly modified the script
function main(workbook: ExcelScript.Workbook) {
try {
const stuChassis = workbook
.getWorksheet("STU Chassis")
const stuChassisUsed = stuChassis
.getUsedRange()
stuChassis
.addTable(stuChassisUsed, true)
.setName("STUChassisTable")
}
catch (error) {
console.log("There are already tables present in STU chassis");
console.log(error);
}
return
}
- BradynHinJun 05, 2023Copper Contributor
SergeiBaklan Yes, even in a new workbook and using your revised code, I get the same error. Could it be a permissions error?
- SergeiBaklanJun 05, 2023Diamond Contributor
That's usually workbook/sheet protection, but in that case I have another error
If not protection have no idea what it could be.