How can we write datas into an excel file using AS

Results 1 to 2 of 2

Thread: How can we write datas into an excel file using AS

  1. #1
    Join Date
    Dec 1969

    Default How can we write datas into an excel file using AS

    Hi,<BR><BR> I have two excel files named ExcelData1.xls and ExcelData2.xls. Both the files contain five sheets. Sheet names are same. I want to read from ExcelData1.xls and want to write into ExcelData2.xls. Also I want to insert these datas into SQL Server Database. This is to be done using ASP.NET and VB.NET. <BR><BR>Please send the detailed code and explanation.<BR><BR>Thanks<BR>Regards<BR>Girish Kumar V

  2. #2
    Join Date
    Dec 1969

    Default RE: How can we write datas into an excel file usin

    If your data is formatted properly (like a DB Table) you can connect to an Excel Spreadsheet with the Jet OleDb Provider, the same way you would connect to a database. The connection string can be found here: cel<BR><BR>You can access and operate on the data via standard SQL syntax. There are thousands of examples on the Net and I do believe that there is a FAQ on this site [sort of:].<BR><BR>Here is as small example:<BR>string xlsLink = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:InetpubwwwrootCS_TestRANKS.xls;Extended Properties=""Excel 8.0;HDR=Yes""";<BR>OleDbConnection xlsConn = new OleDbConnection(xlsLink);<BR>string sql = "SELECT * FROM [PLAYERS$] ORDER BY RANK";<BR>xlsConn.Open();<BR>OleDbCommand xlsComm = new OleDbCommand(sql, xlsConn);<BR>dgXLS.DataSource = xlsComm.ExecuteReader(CommandBehavior.CloseConnect ion);<BR>dgXLS.DataBind();<BR>if(xlsConn.State == ConnectionState.Open){xlsConn.Close();}<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts