[Fixed] Script Editor web-part missing in SharePoint Online.

Script editor web-part is used in SharePoint online to add custom HTML, JS elements in SharePoint pages. In general script editor web-part allows users to customize SharePoint sites. But however, in SharePoint online script editor web part is hidden by default and you need to run power shell command to enable it. As the script editor web-part is hidden, most users think that the feature is missing in SharePoint Online.
Do not worry, follow the below steps to enable/unhide the script editor web part for SharePoint online site.

Reason behind missing web-part in SPO
Script editor is not always hidden, it depends on the site you are in or you have created. If you look/examine carefully you will see that Script editor web part is mostly missing for SharePoint “team sites” but available for communication sites and development sites. True, right?, but why? Well if you think from a users point of view. An user do not need the script editor web-part to create a custom add-in/web-part, It is the job of developers to create and test add-ins. That is why script editor web-parts are hidden/ missing by default in SharePoint online team sites.
Also another reason might be that Microsoft is trying to slowly remove custom JavaScript add-in capability from SharePoint online. The new method for developing SharePoint add-ins is by using SPfx web-parts. Spfx is more robust and secure and can be added to modern SharePoint pages as well, hence Microsoft is moving that way.
(This is my understanding, the actual reason may be different).
Enable The Script Editor Web-part for SPO – Quickly
To enable the script editor web-part for SharePoint Online site, follow the below steps. One Point to note, you need to be a SharePoint admin to enable it.
For the list of SharePoint PowerShell commands check this Microsoft documentation.
- Run PowerShell as an admin

- Check if you have the SharePoint online PowerShell module. Run the following command, if you do not see any output then you do not have the PowerShell Module Installed. (To install the module, run the next command)
Check Module: Get-Module -Name Microsoft.Online.SharePoint.PowerShell -ListAvailable | Select Name,Version
Install Module (admin): Install-Module -Name Microsoft.Online.SharePoint.PowerShell
Install Module(non-admin): Install-Module -Name Microsoft.Online.SharePoint.PowerShell -Scope CurrentUser
As you can see in the following image, I have installed the module as I did not have it installed previously.

- Next connect to your SharePoint online tenant using the following command, (login if prompted)
command(Change your site URL): Connect-SPOService -Url https://yourtenant-admin.sharepoint.com
The command should execute without any errors. If you receive any errors, check if you have correct permissions(SharePoint Administrator Role).

- If the previous command was successful, run the following command to enable the script editor feature.
This feature can be enabled only for a particular sub site as well.
Command: Set-SPOSite <Your Site URL> -DenyAddAndCustomizePages 0
The command should execute without any errors. If any errors check PowerShell version and if you have site collection admin access or not.

- If the command runs successfully, wait for 15-20 mins and check if the script editor is enabled. If the Script editor web part is still missing, the follow the previous steps again. If it is missing after following the steps again, then check your SharePoint tenant settings or contact Microsoft support.
After successful execution, you should be able to see the web part as below.

That’s all for this post. I hope now you understand why script editor web part is missing in SharePoint online and how to enable it. If you liked this post, please consider checking our other posts related to SharePoint Online troubleshooting and development using this link.
If you liked this post then please consider supporting us by buying something using the below links. Thank you.
Please Help us Grow!
I hope you have found this article helpful. If you are happy with the document, please use the below links when you buy something from Amazon to help us grow.
Ways to Help
Amazon Affiliate Links
How this works?
Amazon affiliate program gives a small (%)share of price to the referrers, so feel free to buy anything.
Below are some Amazon affiliate links, if you open amazon application/website using these links and buy something, (it can be one of the below items or anything of your choice) Then Amazon will give us a little percentage(%) of the money you spend on Amazon. To know more check this document.