[dba-VB] Exporting Data to an Excel Spreadsheet

Stuart McLachlan stuart at lexacorp.com.pg
Tue Sep 27 14:41:29 CDT 2011


Honestly, programmers these days!  If there's no "built in method",  they're lost.  That's what 
.Net does for your :-)
 
Grab some data ( any data)
Open a file for Output
Step through your data, building a comma separated list for each record and write it to the a 
file.

If you want to write the data into an actual Excel file, use COM.  Again, step through your 
data writing values out to the file,  You could base it on something like
http://vb.net-informations.com/excel-2007/vb.net_excel_2007_create_file.htm

-- 
Stuart

On 27 Sep 2011 at 10:26, Dan Waters wrote:

> I have unfortunately discovered that there is no built-in method to
> create a spreadsheet from within VB.Net, similar to
> DoCmd.TransferSpreadsheet like there is in Access.
> 
> I've tried three different methods, but all have failed for one reason
> or another.  There are numerous 3rd party solutions, but right now I
> just need to do the basic step of creating a csv or xls file.
> 
> I'm starting with a Linq query (an IEnumerable).  I'd like to use this
> as the starting point, but I could convert that to a DataTable, or to
> a DataSet if needed.
> 
> If anyone does this successfully, please let me know.
> 
> Thanks!
> Dan
> 
> 
> _______________________________________________
> dba-VB mailing list
> dba-VB at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/dba-vb
> http://www.databaseadvisors.com
> 
> 






More information about the dba-VB mailing list