Error: Write DataTable to Excel: Type 'System.Guid' cannot be marshalled to a Variant. Type library is not registered

Hello,

I have a process which has to run querry from my sql database and write it on the excel file. I did it for once and ı have working one. But ı want to do it for another process and ı had this error : Write DataTable to Excel: Type ‘System.Guid’ cannot be marshalled to a Variant. Type library is not registered.

My steps shown in below ;

Run querry
Output datatable
Excess Process Scope > Use excel file > Write datatable to excel

I dont get any errors from first two steps.

I am waiting for your answers thanks !

@arif_samet_ipek

Looks like one of the column type from your sql db is of guid type and it is unable to write or identify it as per excel types

One work around would be to change the column type to string…you cannot directly change…instead add a new column with same name as the guid column and with type of column as string

And then use assign as below

Dt.Columns("NewColName").Expression = "[OldColName]"

Or you can also use invoke code with the following where dt is the datatable to be passed as in/out argument

Dt.AsEnumerable.ToList.ForEach(Sub(r) r("NewColumnName") = r("OldColumnName").ToString)

Cheers

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.