Free Support Forum -

Text file and template xls


I need help for my project.

I have a text file and a template xls, I need to merge those 2 files!

Is it possible ? I can open the text file with :


but I need to use a template before is it possible ?

Thank you very much


I think you may try to combine the two files, see the sample code below.
Sample code:
Workbook wb1 = new Workbook(@“e:\test2\myfile.txt”, new LoadOptions(LoadFormat.TabDelimited));
Workbook wb2 = new Workbook(“e:\test2\xlsfile.xls”);

Also, you may try to copy the worksheet b/w workbooks, see the topic:

Thank you.

Thank you for your solution,

but if I use the "combine" method, I obtain 2 worksheets but the data use the template.

I need to have only one wooksheet for result.

best regards


In that case, I am afraid, you need to do it manually. For example, you may load the XLS file first, now load the second tab delimited file, export data to fill a data table or array from your tab delimited worksheet. Now, you can import data from data table/array to your XLS file' worksheet at your desired location.
See the topics on how to export and import data from/to worksheet:

Another way can be copying ranges:

An agricultural way can be, you may put value cell by cell using Cell.PutValue() method in the XLS file from your tab delimited worksheet obtaining in a loop using Cell.StringValue() etc.

Thank you.