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

Free Support Forum - aspose.com

Performing mailmerge with data coming from csv-file


I’m trying to figure out how (if possible) I can perform a mailmerge with my data coming from a .csv file. I’m testing Aspose.Words for Java, and I’m trying to merge all our current documents with the same datasource (a .csv-file) as our old applications. However, I haven’t found any clues in the documentation or the forum on how to do so. How I’ve managed to test the merging (which works splendidly, I have to say), is to create a simple xml from the csv (the tags being the field names). This is however a big detour, which is fine for small datasets, but once they get bigger, it creates a lot of overhead. So in short : I have a template, I have a csv file. What is the quickest and most efficient way to perform the merge?

Thanks in advance

Kind Regards

Matthias Vermeiren


Thanks for your request. I think the simplest way to achieve this will be reading your CSV file into a ResultSet and then use this ResultSet as a data source for mail merge. For example, you can use the tool suggested here to read a CSV file into ResultSet:


As another option, you can try parsing your CSV file yourself and use IMailMergeDatasource and a data source for mail merge:


Best regards,