How to use Excel service

I’m trying to make a workflow for generating of xls file by this way:

The PathAndFileName parameter contains full path and file name.

I tried to set the CastToDataType of the Product parameter as Xml, Array, String…
Regardless the setting, I get the error message “Exception of type 'System.InvalidCastException' was thrown.
What’s wrong?

First of all you should pass the Entity parameter. In that parameter you should state which entity from the provided data structure contains the data to be saved. You can pass it e.g. using a constant value. In your case I suppose it would be Product.

Please also provide the full stack trace together with the error message so it is more obvious where the problem happens. Thanks.

Do I understand well, that the Entity parameter should contain the entity name?
What is the purpose of this parameter?

I’ve tried to make it by this way:

No change in the result state:

2017-07-10 11:51:46,243 [3732] ERROR CZ.Advantages.Asap.Workflow.WorkflowEngine [(null)] <ORIGAM12\origam> - Exception of type 'System.InvalidCastException' was thrown.
CZ.Advantages.Asap.AsapException: Exception of type 'System.InvalidCastException' was thrown. ---> System.InvalidCastException: Exception of type 'System.InvalidCastException' was thrown.
   at CZ.Advantages.Asap.Workflow.FileService.ExcelAgent.Run()
   at CZ.Advantages.Asap.Workflow.Tasks.ServiceMethodCallEngineTask.OnExecute()
   at CZ.Advantages.Asap.Workflow.Tasks.AbstractWorkflowEngineTask.Execute()
   --- End of inner exception stack trace ---```