Adding a custom template for extracting data in excel - asp.net

I'm currently working on a project which one of its modules is to upload a custom excel file then my code should recognize the excel file's template.
then Users should be able to determine which data is put in which excel field.
I am writing this with asp.net mvc. and so far I'm screwed. anyone knows where should I start? or what library I should Use? I'd really appreciate the help

For Fetching Excel File data in c# , I recommend you to study about Aspose.Cells, It is a third party Dll, There API is Easy to understand and Very Easy to implement.
In that you can Fetch Your Excel Files as
Workbook - Full Excel File
Worksheets - Sheets Inside Excel File
Cells - Group of Excel Cell
Cell - A single Cell which you can access in the form of 2D Array like A1 Cell of Excel Sheet Will be Cell[0][0];
It also gives you facility to put formulaes, Sorting, Blank Row Deletion and many more Things
Here you can easily Export your Excel sheet in a DataTable and vice Versa
Have a look at it is Easier to use.Thanks

https://github.com/closedxml/closedxml/wiki/Showcase
this library was close to what I needed.

Related

download data in excel from database without GridView

I Have to fetch data from database and download in Excel format without DataBind() on any Control.
Is There any Possible way to accomplish this task?
If you need to download in xlsx format, I can recommend ClosedXml - none of the nightmare of interop and requiring Excel on the same machine. Quite easy too - see this example: Adding DatatTable to Worksheet (ADO.net).
See also this example for delivering an Excel file with ASP.net

Automatically adding rows to excel file template

I am running .net 4.0 asp.net app on IIS 7. I want to know if there is an easy way of adding rows to an excel 2007/2010 (not too fussed) template file that a user can download from the server.
For example, the user might check a couple of tick boxes and clicks a button on the web page. The server does a sql query on a table and comes back with the results. I have an excel file with some headings, column titles, formatting etc. on the web app's resources directory. I want to make a copy of this file, insert each of the results as a row into this file (insert first name into cell A3, last name into cell B3 etc.). And make it available for the user to save on their disk.
Since Excel (xls) format is an "Open format", I was wondering how easy/straight forward this would be. Is it a matter of loading the excel XML DOM and inserting XML elements? What are libraries I need to use?
Any help or resources would be greatly appreciated.
I did exactly this using an Excel template. You'll see how easy it is to do this using open source libraries as NPOI.
These links should help you get there:
Create Excel (.XLS and .XLSX) file from C#
Creating Excel spreadsheets .XLS and .XLSX in C#

generating nicely formatted excel files in ASP.net without having Excel on server

Generating normal columnar data in excel file is quite easy but does any one of you have generated excel files having datas in different blocks placed in different sheets and beautifully formatted without having to manipulate the excel file using COM [which i want to avoid]. Any ideas would be really helpful.
The output excel file should be compatible with Office 2003 + office 2007
Don't know exactly (as I've Excel installed on both my dev and server machines) but I think ExcelPackage can do the trick.
Check spread sheet gear, with the help of spread sheet gear I have created excel with very good formating as well
http://www.spreadsheetgear.com/
If you're not creating many spreadsheets, or don't wish to buy a product which makes this easier, your solution might be to use templates.
Create a excel document, in the style you want, then save it as xml.
Then modify the xml document as you like, using place holders or whatever, to generate your documents.
This works for simple reports where you don't want to use a 3rd party product.
For anything else I'd recommend a product specializing in this.
You can check SmartXLS for .net.

export to excel file from asp.net

I have an ASP.NET 3.5 site that needs to export data to a pre-formatted Excel sheet. I am not allowed to modify the excel sheet in any way, just drop data into specific cells.
My question is, What is the simplest way to do this from an ASP.NET site. The user will always have Excel on their machine.
Is a 3rd party control my best option or is this a relatively simple task using VB.NET ?
dear use ExcelPackage. It rocks!!! I've used it in my project. It can take a preformatted excel file and use it as template. It is also very easy to use.
Use NPOI (http://npoi.codeplex.com/) if you want Excel 2000-2003 compatibility, or ExcelPackage (http://excelpackage.codeplex.com/) if you're only targeting Excel 2007/2008.
I've also rolled my own XML output in the older SpreadsheetML format (Excel 2002/2003), it was MUCH easier than the newer OOXML (Excel 2007/2008) format.

List of objects to Excel Spreadsheet?

Anyone know of some code out there that does this already? I have a bunch of pages with data grids on them in an admin website they want to export them to Excel, was hoping someone had this written already - or if not I'll post mine when I am done.
Excel can open files in the format of CSV and XML - it can also generate the schema file.
if you have data grids then the chances are you have data sets.
There is a method on the dataset to output as XML.
you probably have to use an xmlWriter to save the file.

Resources