We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

ImportDataTable and existing columns

Hi !

I am currently testing Aspose.Cell for my company, and I have a question about the “ImportDataTable” function.

Basically, I have some data on a DataTable, and I want to insert it on a worksheet which already contains custom columns.

Let’s say the DataTable has 20 columns and 10 rows, and my customs values start at column 25.
I use the “DeleteRange” function to clear everything that could exist from column 1 to 24, then use “ImportDataTable” to insert my data on that space.

The problem is, my existing values do stay on the right column (25), but are moved to row 11, under the new data I insert. It’s like the import cleared everything on his right and moved it to the bottom.
Since those values are actually formulas I want to apply on my data, I would like to know if it is possible to maintain them at the exact same place ?


Hi Bruno,

Thank you for considering Aspose APIs.

Please share a sample application along with the input & output spreadsheets for better understanding of your presented scenario. It would be of great help if you can also share your desired results that you may create manually using MS Excel application. Upon reviewing the above requested, we will try our best to propose a solution with Aspose.Cells APIs.


Thanks for your query.

Well, by default, ImportDataTable() method would insert blank rows and then inserts data to those rows in the sheet. I think you should pick suitable ImportDataTable overloaded version of the method for your needs, see the sample line of code for your reference, it will start inserting the DataTable at A1 cell position but won’t insert new blank rows:
Sample code:

worksheet.Cells.ImportDataTable(dataTable1, true, 0, 0, false); // please set the last Boolean parameter “insertRows” to false.

Let us know if you still find any issue.

Thank you.

Well, that was fast. And correct.

I thought that using ImportDataTable with the total rows and columns specified would avoid that issue, I missed the insertRows parameter, my bad.

Thank you both for the answers !


Good to know that your issue is sorted out now. Feel free to contact us any time if you need further help or have some other issue or queries, we will be happy to assist you soon.

Thank you.