 <p>You can use one of the libraries which allow you to create and manipulate Excel files, like <a href="http://epplus.codeplex.com/" rel="nofollow">EPPlus</a> (open source) or <a href="http://www.aspose.com/" rel="nofollow">Aspose</a> (commercial). I have a positive experience with the latter.</p>