I&#039;d like to have a link on a page that downloads the contents of a datagrid into an Excel file. I&#039;ve found some handy code that does this using the stringwriter and htmltextwriter classes. My problem is that the formatting of the file is not great and I can&#039;t seem to control the name of the file or the worksheet. Also, I&#039;d like to figure out how to download multiple datagrids from one page into separate worksheets in one workbook. Here is the code snippet I&#039;ve currently got:<BR><BR>Response.ContentType = "application/vnd.ms-excel"<BR>&#039; Remove the charset from the Content-Type header.<BR>Response.Charset = ""<BR>&#039; Turn off the view state.<BR>Me.EnableViewState = False<BR>&#039;get the datagrid from the session variable into a local dataview<BR>Dim ldvExport As DataView = Session("lds_lic_expire")<BR>Dim lswWriter As New System.IO.StringWriter()<BR>Dim lhtwWriter As New System.Web.UI.HtmlTextWriter(lswWriter)<BR>Dim ldgGrid As New DataGrid()<BR>ldgGrid.DataSource = ldvExport<BR>ldgGrid.DataBind()<BR>&#039; Get the HTML for the control.<BR>ldgData.RenderControl(lhtwWriter)<BR>& #039; Write the HTML back to the browser.<BR>Response.Write(lswWriter.ToString())<B R>&#039; End the response.<BR>Response.End()<BR><BR>Does anyone have any ideas on how to do those things either using this technique or another?<BR><BR>Thanks in advance,<BR>Sara