First, enable the custom scripting from the admin center by following the below the navigation, then need to execute the PowerShell script - I had also faced this but with the combination of these two - got it fixed.
Go to your tenant setting page thru this URL
https://sprnd-admin.sharepoint.com/_layouts/15/online/TenantSettings.aspx
Note: Here “spend” is my tenant name, you need to pass your tenant name.
Now see the “Custom Script” section by default both the radio button is selected as prevent – this is the default behavior and due to this script editor and content editor web part is missing from SharePoint online page.
Now select to allow users to run the custom script for both the radio button as like below:
Allow users from running custom script on personal sites. Allow users from running custom script on self-service created sites)
This will not enable the custom script until we execute the below PowerShell Script.
$adminUserID=”youradminaccount@< sprnd.onmicrosoft.com >” $userCredential = Get-Credential -UserName $adminUserID -Message “Enter password” Connect-SPOService -Url https://sprnd-admin.sharepoint.com/ -Credential $userCredential Set-SPOsite “https://sprnd.sharepoint.com/sites/TestSite001″ -DenyAddAndCustomizePages 0 Once, we execute the above PowerShell script, immediately script editor will be available.
For details refer to the below article:
SharePoint Online – O365: How to enable script editor web part in SharePoint online
