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
}