I am creating and downloading an excel sheet using excel.js. I have a task like making certain columns and rows uneditable. I searched for it, I got a way like giving protected{locked: true} should protect the cells and should be uneditable, but when i download the excel, iam still able to edit the cells.
mergedWorkbook.eachSheet((worksheet) => {
const lastColumnIndex = worksheet.columns.length;
const protectedColumns = [0, 1, 2, lastColumnIndex];
// Protect specified columns
worksheet.columns.forEach((column, columnIndex) => {
if (protectedColumns.includes(columnIndex)) {
column.eachCell((cell) => {
cell.protection = {
locked: true,
};
});
}
});
// Protect header row
worksheet.getRow(1).eachCell((cell) => {
cell.protection = {
locked: true,
};
});
});