Work Book Write Cell: Error - Unable to cast object of type 'Newtonsoft.Json.Linq.JValue' to type 'System.String'

Hi All,

I am getting strange error in “Write Cell” Activity in one of the machine where UiPath (Version - 2016.2.6274)

Strange Behavior is same “Workbook: Write Cell” activity was able to write in same macro enabled excel sheet Yesterday, Today it is unable to write and throwing below exception and changes data in sheet (it adds unexpected data in different sheets)

Note - There is no change in excel sheet and there is no system or UiPath updates on this machine.

Same workflow & excel sheet is working fine in another machine.

Any idea how to investigate or resolve?

An error has occured

Message: Unable to cast object of type ‘Newtonsoft.Json.Linq.JValue’ to type ‘System.String’.

Source: System.Xml

Exception Type: InvalidCastException

System.InvalidCastException: Unable to cast object of type ‘Newtonsoft.Json.Linq.JValue’ to type ‘System.String’.
at System.Xml.XmlException…ctor(SerializationInfo info, StreamingContext context)
at Void .ctor(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)(Object )
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateISerializable(JsonReader reader, JsonISerializableContract contract, JsonProperty member, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
at UiPath.Shared.JsonParser.DeserializeObject[T](String jsonValue)
at UiPath.Models.UiPathDuplexProxy.<>c__DisplayClass21_0.b__0()
at System.Threading.Tasks.Task.InnerInvoke()
at System.Threading.Tasks.Task.Execute()

Hi,
Try following and let me know.

  • create new excel file and try to write some data using write cell(try with different path also)

  • Is write cell of (excel scope) working fine?

  • How about create new workflow and copy the entire Workflow to it.

  • Last approach would be repair UiPath and install all the updates .

Thanks @ddpadil for your suggestion, Please find my updates inline below:

Ok cool.

  • Then why don;t you save your excel(which has the problem writing) to with another name(save as) and give a try.

  • If its working fine within excel scope then problem with workbook(try to update package if any) is there any specific reason your using workbook write cell? if not then please use excel write cell.

  • In control panel you get an option right repair/uninstall option.
    If you don’t see repair option then uninstall and install.

@ddpadil -

Finally it is resolved by deleting macros from that sheet.

Btw, Problem was specific to that machine only.

Thanks for you help.

Ok have a nice day :blush:

1 Like