I've been able to narrow it down, but I can't see the specific data type which is causing it to fail. How it comes about is like this...
I am using a remote database to fill the grid.
If I fill the grid with 'good' data where all entries seem to be string, integer, and even 'undefined' the Excel export works fine.
But if I use a 'left outer join' which populates all the data from a 'master' table and only some of the grid cells receive matching data from the 'subtable' I think the export function doesn't like the format of some (or all) of the empty grid cells. In this event it will not export to Excel and throws the error mentioned in the original post.
I don't know whether the empty grid cells are 'null', empty string, empty string where integer is expected or whatever, but if I apply a filter after the data is loaded so that all the empty cells are removed then it will export to Excel once again.
I will experiment to try to determine which datatype is in the empty cells and causes the fault, but it would also be helpful if you can identify from your source code what sort of datatype would cause your export function to fail. Hopefully we can the draw the same conclusion.
I hope this extra description is useful.