How to insert data into a particular cell in a Excel Work sheet in Asp.net
Does the worksheet already exist? If it does you can open the worksheet using the open-source component Koogra og the commercial component from Infragistics (there are others as well) and modify it in code. The alternative is to open the worksheet using excel automation, but that is not recommended in a web project.
By the way. You are not the first to ask this question.
I think you need to provide a little more information..
Off the top of my head, you could approach this a number of different ways :
1) MS Office Automation - Using javascript you could open Excel, open the 'correct' document and then insert the particular data in the cell.
Issues with this method
You will need to ensure that your site is in the trusted sites list in IE to perform office automation. This may not be possible unless you are writing an intranet application.
I've only used automation in IE before, it may not work in Firefox.
It relies on the user having Excel installed and the correct file downloaded to their computer and available.
2) Roll your own Excel document - Probably easiest if your users version of Excel supports xml worksheets, Open the excel sheet server side, then using something like XPath queries find the relevant cell in the worksheet and insert your data. Stream the sheet out to the user as part of the HTTP Response.
Issues with this method
The spreadsheet will always be from the server copy, unless you provide some mechanism for the user to upload their spreadsheet first. This has a whole raft of issues associated with it though.
3) Purchase an Excel Spreadsheet producer application - There are a number of programs out there which have wrapped up the process of creating 'true' (i.e. .xls) spreadsheets into nice easy to use .dll libraries.
Issues with this method
$$$ Involved.
Sorry for the inexact Information.
I ve generated a Excel sheet dynamically during Runtime. Now in that i ve to insert a value into a particular celll For example in A1 i wnat to insert "Chandrika". How to do?
Two primary ways I know of:
- Use a third party tool, I use Aspose
- Change the content type of the page (For output only)
Unless each user of your site has their own sheet, this is a very bad idea. Web sites are inherently parallel in a nature, and Excel does not do anything at all to support concurrent access.