
Thanks for reaching Q7A Forum with your question about Office Scripts and account deletion.
Based on my research and official Microsoft documentations, Office Scripts are typically stored in your OneDrive under /Documents/Office Scripts/. If your account is deleted, your OneDrive is also removed and that means any scripts stored there will be lost, even if they were shared with a Teams team. However, if you transfer your scripts to a SharePoint site associated with your Teams team, they become team-owned and follow SharePoint’s retention policies, which are more resilient to account changes. You might check that you store it in the right place, or if it's not, you can move it to a SharePoint folder.
If account deletion is planned and you still have access, you can manually transfer the owner scripts to another user or to SharePoint. Additionally, Microsoft documentation mentions that admins can temporarily restore a deleted user's OneDrive and transfer script files to another user or to SharePoint.
For long-term script management, some organizations use a dedicated service account to create and manage shared scripts. This helps avoid the risk of losing scripts when individual accounts are deleted and could be a good preventive step for your team.
Here are some official documents that provide deeper insight:
- Learn about retention for SharePoint and OneDrive
- Restore a deleted OneDrive
- Set the OneDrive retention for deleted users
Hope this information is helpful for your case.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.