Worksheet id changed after save excel on desktop

Vipin Bhandari 0 Reputation points
2024-01-30T15:12:55.91+00:00

Problem Statement : We are working on Microsoft add-in AM365. In this Add-in we have consolidated data of all the sheets and user can manipulate the data (update , delete , insert) in grid format. When we save the data in excel we store worksheetId at our end for every sheet so when we reopen the excel again we can create a connection between the AM365 and worksheets. After reopening the workbook user can continue the data manipulation using AM-365. But after saving the workbook the worksheetId gets changed and user is no longer able to continue working on same excel using AM-365.

Steps :

  1. Open Excel desktop
  2. enter some data into cells
  3. Click on automate and click on new script and run script on right panel
   function main(workbook: ExcelScript.Workbook) {
   
       const y = workbook.getWorksheets().forEach(a => { console.log(a.getId()) })
   
   }
   
  1. check the worksheet id
  2. Now save the excel as .xlsx and close excel and reopen the same file again.
  3. repeat step 3 again.

match the before save and after save worksheet id.

Actual : Both worksheet ID before save and after save are different.

Expected : Both ID should be the same before save or after save.

Microsoft 365 and Office | Development | Other
Microsoft 365 and Office | Excel | For business | Windows
{count} votes

1 answer

Sort by: Most helpful
  1. Jan Karel Pieterse 1 Reputation point MVP
    2025-07-04T15:37:09.87+00:00

    I tried but cannot reproduce this issue. I ran the script on a new unsaved file with two sheets, got this:

    Sheet1: {1E061105-0C2E-4682-8A8B-19943DBD4218}

    Sheet2: {2B268BEB-56AC-4BCB-9E6B-0F90F2FD429F}

    After saving, closing and reopening the same file, I got exactly the same IDs

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.