Home » Tutorials » ASP.NET » Import/Upload Excel file in asp.net with C#

Import/Upload Excel file in asp.net with C#

pivot and unpivot in sql server
The remote server returned an unexpected response: (413) Request Entity Too Large.

We have already explained you regarding RANK(), DENSE_RANK(), ROW_NUMBER() , Aggregate functions in sql server and Identity column in sql server. Today I am going to explain you regarding how to import/upload excel file and display it using OLEDB.

I was seating and was thinking what to post today. But one of my friend was looking for solution about how to import/upload excel file in asp.net with C#. And i give him a following solution.

Step: 1: First we need to create one excel file like below:

TestExcel

Step:2: We will Create one page for upload excel file like:

Step-3 : Now open code behind code and add following namespaces

Step-4: After that add below code at btnupload click event

Step-5: Run application and you will get following result:

ExcelDataDisplay

You can also download Demo code by Clicking Me.

string path = Server.MapPath(FileUpload.PostedFile.FileName);

FileUpload.SaveAs(path);

Use Server.MapPath for asp.net production website to avoid unwanted errors.

Try some basic function with uploaded file like Save,SaveAs,Delete,etc. And let me know in comment, if you facing any problem. I will try to upload about it.

Thanks 🙂

About

Leave a Reply

Your email address will not be published. Required fields are marked *

*
*

Time limit is exhausted. Please reload CAPTCHA.




DISCLAIMER:
The content is copyrighted to technothirsty.com and may not be reproduced on other websites without permission from the owner.You may contact us using the information below.