You can use a library called ExcelLibrary. It's a free, open source library posted on Google Code:
ExcelLibrary
This looks to be a port of the PHP ExcelWriter that you mentioned above. It will not write to the new .xlsx format yet, but they are working on adding that functionality in.
It's very simple, small and easy to use. Plus it has a DataSetHelper that lets you use DataSets and DataTables to easily work with Excel data.
ExcelLibrary seems to still only work for the older Excel format (.xls files), but may be adding support in the future for newer 2007/2010 formats.
You can also use EPPlus, which works only for Excel 2007/2010 format files (.xlsx files). There's also NPOI which works with both.
There are a few known bugs with each library as noted in the comments. In all, EPPlus seems to be the best choice as time goes on. It seems to be more actively updated and documented as well.
Also, as noted by @АртёмЦарионов below, EPPlus has support for Pivot Tables and ExcelLibrary may have some support (Pivot table issue in ExcelLibrary)
Here are a couple links for quick reference:
ExcelLibrary - GNU Lesser GPL
EPPlus - GNU (LGPL) - No longer maintained
EPPlus 5 - Polyform Noncommercial - Starting May 2020
NPOI - Apache License
Here some example code for ExcelLibrary:
Here is an example taking data from a database and creating a workbook from it. Note that the ExcelLibrary code is the single line at the bottom:
//Create the data set and table
DataSet ds = new DataSet("New_DataSet");
DataTable dt = new DataTable("New_DataTable");
//Set the locale for each
ds.Locale = System.Threading.Thread.CurrentThread.CurrentCulture;
dt.Locale = System.Threading.Thread.CurrentThread.CurrentCulture;
//Open a DB connection (in this example with OleDB)
OleDbConnection con = new OleDbConnection(dbConnectionString);
con.Open();
//Create a query and fill the data table with the data from the DB
string sql = "SELECT Whatever FROM MyDBTable;";
OleDbCommand cmd = new OleDbCommand(sql, con);
OleDbDataAdapter adptr = new OleDbDataAdapter();
adptr.SelectCommand = cmd;
adptr.Fill(dt);
con.Close();
//Add the table to the data set
ds.Tables.Add(dt);
//Here's the easy part. Create the Excel worksheet from the data set
ExcelLibrary.DataSetHelper.CreateWorkbook("MyExcelFile.xls", ds);
Creating the Excel file is as easy as that. You can also manually create Excel files, but the above functionality is what really impressed me.
The .Net Framework 3.5 SP1 redistributable (the one that's around 230MB) contains everything (2.0 + SP1 + SP2, 3.0 + SP1 + SP2, 3.5 + SP1) in all supported architectures (x86, x64, ia64). This is the only download you need.
Download from here (click on .NET Framework 3.5 Service Pack 1 (Full Package)):
And then, you might want to install these updates:
IMPORTANT: After installing the .NET Framework 3.5 SP1 package (either the bootstrapper or the full package) you should immediately install the update KB959209 to address a set of known application compatibility issues.
There are 3 updates (for 2.0, 3.0, and 3.5) for 2 OS "groups" (XP/2003 or Vista/2008) for 3 architectures (x86, x64, or ia64), for a total of... 16 downloads! (I know, 3 * 2 * 3 = 18, but Server 2003 ia64 only supports up to 2.0). You need to install the 3 updates in order. Or you could run Windows Update after installing 3.5 SP1 and let it figure it out.
EDIT: To be clear, .Net 3.5 requires that 2.0 and 3.0 be installed and updated to SP1 level. .Net 3.5 SP1 requires that 2.0/3.0 be updated to SP2 level. But the 3.5(SP1) installers will do this automatically. That is, by installing 3.5 SP1, you don't need to worry about installing and updating 2.0 and 3.0 to SP1 or SP2. Just install 3.5 SP1 and you're done! (and the extra updates, 3.5 SP1.1?)
About the Client Profile, it can only be installed on x86 client machines that don't have ANY version of .Net installed, so it won't install on Vista (it already comes with .Net 3.0), any Windows Server version, nor any x64/ia64 OS. You can only install it on a Windows XP SP2+ (x86) that doesn't have any version of .Net installed, otherwise a full installation is done. The offline Client Profile installer is 255MB because it will try to do a client install first, if it can't it will fallback to a full install. Personally, I would just do a full install anyway.
Best Answer
The .NET 3.5 SP1 Full package is sufficient for everything* (as long as you have Windows Installer 3.1 or later installed), and requires no extra download or internet connection.
You do not need the compact framework.
If you only require .NET 2.0 SP2, you can download it here.
*** This includes all the latest SP's for .NET 2 and 3.