Currently I have created one excel Addin in which I am selecting one template excel in file upload and using insertWorksheetsFromBase64 method to import all sheets from template to current workbook.
let myFile = document.getElementById("file");
let reader = new FileReader();
reader.onload = (event) => {
Excel.run((context) => {
// Remove the metadata before the base64-encoded string.
let startIndex = reader.result.toString().indexOf("base64,");
let externalWorkbook = reader.result.toString().substr(startIndex + 7);
// Retrieve the current workbook.
let workbook = context.workbook;
// Set up the insert options.
let options = {
sheetNamesToInsert: [], // Insert all the worksheets from the source workbook.
positionType: Excel.WorksheetPositionType.after, // Insert after the `relativeTo` sheet.
relativeTo: "Sheet1" // The sheet relative to which the other worksheets will be inserted. Used with `positionType`.
};
// Insert the new worksheets into the current workbook.
workbook.insertWorksheetsFromBase64(externalWorkbook, options);
return context.sync();
});
};
// Read the file as a data URL so we can parse the base64-encoded string.
reader.readAsDataURL(myFile.files[0]);
But after this all cell links in inserted sheets showing blocked content like shown in image Error Screenshot
As per my understanding it is not updating cell reference as per current excel. Can someone please help how can i update reference as well.
Update After clicking on continue get below error