1
votes

I am using office.js to create excel add-ins. I am creating hidden sheet with certain json object on click of button from task pane. Now the requirement is if user saves workbook locally using native save option and if he opens workbook again in offline mode and try to launch add-ins at that time wants to read the hidden sheet data and populate it into the task pane.

Please prove the info how I can implement this functionality. It will be helpful. Thanks in advance.

1
What specific part are you having trouble with? Showing the add-in when offline? Locating the hidden sheet? Extracting the data from it? Also: If you show how you create the hidden sheet and its data, that will help people help you. - T.J. Crowder
@ T.J. Crowder, Thanks for comments. Actually whenever user opens workbook and loaded add-ins and from task pane button click wants to find if workbook contains any hidden sheet and if yes then how to read data from it. - sagar

1 Answers

1
votes

From your comment, it sounds like you're having trouble finding the hidden worksheet.

You find it either by name, or by searching for a worksheet with the same value for the property you set when you were hiding it: visibility

context.workbook.worksheets.load("items");
await context.sync();
for (const sheet of context.workbook.worksheets.items) {
    sheet.load("visbility");
}
await context.sync();
for (const sheet of context.workbook.worksheets.items) {
    if (sheet.visibility !== "Visible") { // Or === "Hidden" or === "VeryHidden", depending on your code
        // This sheet is hidden
    }
}