Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
Aspose.Cells for Node.js via C++ exposes the Protection.isProtectedWithPassword() property to detect if a worksheet is password protected. The Boolean property returns true if the worksheet is password‑protected and false otherwise.
const path = require("path");
const AsposeCells = require("aspose.cells.node");
// The path to the documents directory.
const dataDir = path.join(__dirname, "data");
const filePath = path.join(dataDir, "sample.xlsx");
// Create an instance of Workbook and load a spreadsheet
const book = new AsposeCells.Workbook(filePath);
// Access the protected worksheet
const sheet = book.getWorksheets().get(0);
// Check if worksheet is password protected
if (sheet.getProtection().isProtectedWithPassword()) {
console.log("Worksheet is password protected");
} else {
console.log("Worksheet is not password protected");
}
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.