For updating the external IDs of commerce categories, first find the list of commerce categories without external Id. For that create a saved search to examine the external Ids.
Lists -> Search -> Saved Searches -> New
Choose the search type as commerce category.
Set the following as criteria:
Inactive: false
Display in Website: true
External ID (text): Empty
Add the following columns in the results subtab.
External ID, Name, Description, Primary Parent
Sort the result by Internal ID
The result of this search will show all the commerce categories without an external ID.
Update the category external IDs
Customization -> Scripting -> Scripts
Filter on script file: “set-ext-cat-ids.js”
Click on ‘deployment’ link. Click on Edit and then Save and Execute
Select the saved search created earlier and change the search criteria.
External ID (text): not empty
Save and run.

Then, the external ID field is updated for all the commerce categories.

Reference: SuiteCommerce: Web Store Administration | Learn Oracle | NetSuite LCS | NetSuite Training