You want to put a string longer than 32K to CellQ4


I am using the ImportDataTable method to add a DataTable to a worksheet.

If the datatable contains a value who's length is greater then 32K characters I get the error
"You want to put a string longer than 32K to CellQ4"

Is there anyway to have the ImportDataTable method truncate strings greater then 32K so an error is not thrown?

The data is being pulled from an SQL database.


This is a limitation of MS Excel, not Aspose.Cells. MS Excel doesn’t allow you to put a string longer than 32k to a cell.


I understand that this is an Excel limitation. Can Aspose add a feature to automatically truncate strings greater then 32K characters when adding from a datatable?

The DataTable is created from a SELECT statement on a database table.

Right now the only alternative would be for developers to iterate over each row and column in the data table, check the strings length, truncate if necessary and assign the value to a cell. I’m assuming your ImportDataTable method is many times faster then doing this in our code.


We can add a new overloaded ImportDataTable method to automatically truncate too long text. However, I think there are too many ImportDataTables now.


You could also just modify the database query to provide truncated results to the Cells API. Not as clean, but it’s cleaner than iterating the rows yourself.


Yes. I think this approach is better.