Problem with creating new Definition with indicated GUID for Shared Parameters

Hello everyone,

I have some problems with creating new Shared Parameters with indicated GUID. Can you help me with this Dynamo Script please. It’s Excel file and this is shared code.
This script i found on this site and i just add guid on the ExternalDefenition. I checked this script and when we are create new SharedParameter creates new random GUID, but before i indicate a right GUID. I specify GUID in Excel file and add it in Definitions.

Python Script
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

# Import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

# Import RevitAPI
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application

from System.Collections.Generic import *
from System import *

# Import ToDSType(bool) extension method
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
import System
#The inputs to this node will be stored as a list in the IN variable.
dataEnteringNode = IN

_paramName = IN[0][0]
_groupName = IN[0][1]
_paramType = IN[1]
_visible = IN[0][3]
_category = IN[2]
_paramGroup = IN[3]
_instance = IN[0][6]
_guids = IN[0][7]

def ParamBindingExists(_doc, _paramName, _paramType):
	map = doc.ParameterBindings
	iterator = map.ForwardIterator()
	iterator.Reset()
	while iterator.MoveNext():
		if iterator.Key != None and iterator.Key.Name == _paramName and iterator.Key.ParameterType == _paramType:
			paramExists = True
			break
		else:
			paramExists = False
	return paramExists

def RemoveParamBinding(_doc, _paramName, _paramType):
	map = doc.ParameterBindings
	iterator = map.ForwardIterator()
	iterator.Reset()
	while iterator.MoveNext():
		if iterator.Key != None and iterator.Key.Name == _paramName and iterator.Key.ParameterType == _paramType:
			definition = iterator.Key
			break
	message = None
	if definition != None:
		map.Remove(definition)
		message = "Success"
	return message

def addParam(doc, _paramName, _visible, _instance, _groupName, _paramGroup,k):
	message = None
	if ParamBindingExists(doc, _paramName, _paramType):
		if not RemoveParamBinding(doc, _paramName, _paramType) == "Success":
			message = "Param Binding Not Removed Successfully"
		else:
			message = None
			
	group = file.Groups.get_Item(_groupName)
	if group == None:
		group = file.Groups.Create(_groupName)
	if group.Definitions.Contains(group.Definitions.Item[_paramName]):
		_def = group.Definitions.Item[_paramName]
	else:
		message = "creating!"
   		_def = group.Definitions.Create(opt)
	param = doc.ParameterBindings.Insert(_def, bind, _paramGroup)
	return message
#"Start" the transaction
TransactionManager.Instance.EnsureInTransaction(doc)

try:
	file = app.OpenSharedParameterFile()
except:
	message = "No Shared Parameter file found."
	pass
k=0
while k<_paramName.Count:
	builtInCategory = System.Enum.ToObject(BuiltInCategory, _category[k].Id)
	cats = app.Create.NewCategorySet()
	cats.Insert(doc.Settings.Categories.get_Item(builtInCategory))
	if _instance[k]:
		bind = app.Create.NewInstanceBinding(cats)
	else:
		bind = app.Create.NewTypeBinding(cats)
	opt = ExternalDefinitionCreationOptions(_paramName[k], _paramType[k])	
	opt.Visible = _visible[k]
	opt.GUID = Guid(_guids[k])
	if isinstance(_paramName[k], list):
		for i in _paramName[k]:
			message = addParam(doc, i, _visible[k], _instance[k], _groupName[k], _paramGroup[k], k)
	else:
		message = addParam(doc, _paramName[k], _visible[k], _instance[k], _groupName[k], _paramGroup[k],k)
	k=k+1

# "End" the transaction
TransactionManager.Instance.TransactionTaskDone()
	

	#Assign your output to the OUT variable

if message == None:
	OUT = message
else:
	OUT = message

Thank you in advance.

Best, Denis

@DENIS.REMESNIK, can you provide any information on how you may have resolved this?