Import Excel Data to ASP.NET MVC

Поділитися
Вставка
  • Опубліковано 26 січ 2025

КОМЕНТАРІ •

  • @MaiLe-ct5rw
    @MaiLe-ct5rw 2 роки тому

    why i have to end task excel to open excel file in the second time. Can u have better idea?

  • @mihaiflorianenache4110
    @mihaiflorianenache4110 2 роки тому

    I can not use HttpPostedFileBase class. Why ?

  • @anslemopelcastre5980
    @anslemopelcastre5980 5 років тому +2

    For net core, have you a project? .

  • @gleenababy1731
    @gleenababy1731 4 роки тому +1

    Which reference contains the namespace ImportExcelFileInASPNETMVC? I'm facing the error (Please tell me how to get rid of it):-
    Severity Code Description Project File Line Suppression State Error CS0246 The type or namespace name 'ImportExcelFileInASPNETMVC' could not be found (are you missing a using directive or an assembly reference?) WebApplication1 C:\Users\New\Desktop\Kath\WebApplication1\WebApplication1\Controllers\ProductController.cs 8 Active

  • @cihanbozkurt30
    @cihanbozkurt30 4 роки тому

    This structure does not work on the server side. I do not have problems in local. But the server does not add. Could you help ?

  • @quockyla8415
    @quockyla8415 4 роки тому

    i have a problem, but with property of database Type is Date or Datetime, how to convert, i try Convert.ToDateTime() and DateTime.Parse() but i not work. pls rep me

  • @gauravnautiyal2925
    @gauravnautiyal2925 4 роки тому

    why u have taken i=3 in for loop

  • @khoalam8017
    @khoalam8017 8 років тому +2

    can you helpl me: how open recent in reference manager visual studio 2015

  • @gennadiigomeniuk5002
    @gennadiigomeniuk5002 6 років тому

    Can you tell me why the value of row in the "for" loop should be 3? It seems like value of 3 works no matter where the table is placed in the sheet.

  • @frknbltci
    @frknbltci 4 роки тому

    heyy, While Coide in line 33, we are taking Process Error. How to fix this issue ?

  • @hienpham6974
    @hienpham6974 8 років тому +2

    I go through all your video and at the end when i import an Excel file the program breaks at System.IO.File.Delete(path); . Can you solve this problem?

    • @haifao8569
      @haifao8569 8 років тому

      I faced the same problem.. open the task manager you will see the excel file in processes chose it and click on end task, I think we should close it from the program

    • @DeepakMalik-pd4ok
      @DeepakMalik-pd4ok 5 років тому +2

      Even I am also facing the same issue. Please use workbook.close and application.quit.

    • @victorjara7438
      @victorjara7438 3 роки тому

      @@DeepakMalik-pd4ok great, its work, thx =)

  • @HagenMobiler
    @HagenMobiler 9 років тому +1

    I suggest you to use those lines in your code:
    string fileName = Path.GetFileName(excelfile.FileName);
    string path = Path.Combine(Server.MapPath("~/Content"), fileName);
    Just after the line
    if (fileExcel.FileName.EndsWith("xls") || fileExcel.FileName.EndsWith("xlsx")) { (line 28 on your code)
    My suggestion (1st line) gets the real file name, just e.g SpreadSheet.xlxs, not the complete path from client side and then it combines to upload files folder Path in server.
    Thanks for you code, was very helpfull

  • @tainguyen7495
    @tainguyen7495 8 років тому

    If data type datetime. how to import into table in database ? tks

  • @hajamainudeen5396
    @hajamainudeen5396 4 роки тому

    Does it works in visual studio 2019?

    • @LearningProgramming
      @LearningProgramming  4 роки тому

      Yes, You can use with VS 2019

    • @hajamainudeen5396
      @hajamainudeen5396 4 роки тому

      Okay, I got an error as Hresult efail has been returned from a call to a COM component, can u help me?

    • @hajamainudeen5396
      @hajamainudeen5396 4 роки тому

      When adding the reference I got the above error

  • @AnuRadha-wb7ev
    @AnuRadha-wb7ev 5 років тому

    Can u please tell. Me the code to directly fetch the data from excel file without uploading it

  • @ozgureren8925
    @ozgureren8925 3 роки тому +1

    great leessonn

  • @RafayKhanfy
    @RafayKhanfy 7 років тому

    Getting error at workbook.ActiveSheet.
    cannot implicitly convert type 'object' to 'microsoft.office.interop.excel.worksheet'.

  • @hungerfreenation1691
    @hungerfreenation1691 4 роки тому

    I get directory error while using Combine function.. because there is no Server.MapPath in .net core

  • @alejandroelizondogonzalez9802
    @alejandroelizondogonzalez9802 6 років тому +1

    Hello, if I bought this code from you, could I get it today?

  • @mohammadaqeel2841
    @mohammadaqeel2841 7 років тому +1

    Thaaaaaaaaaaaaaaaaaaaaaaaaaaaank you Sooooooooooooooooo Much.. You've made my Day..

  • @memansoorimtiaz
    @memansoorimtiaz 8 років тому

    Sir how to insert excel sheet in sql using entity framwork database first?

  • @Gregopaok4
    @Gregopaok4 6 років тому

    i got problem in statement - foreach(var p in ViewBar.ListProduct) ListProduct is not recognized how to solve it?

    • @michaelchandra9100
      @michaelchandra9100 6 років тому

      Perhaps because ListProduct is a variable which given from Controller for throwing it to View. You need to define the ListProduct first so it shouldnt be empty.

  • @vikasgowda351
    @vikasgowda351 3 роки тому

    Can I get a code to delete a column present in excel sheet using asp. Net. I will pay you money for the working code

  • @atiqahazizee1592
    @atiqahazizee1592 5 років тому

    it shows no error, but i can't display my data from the excel worksheet

  • @AlemaxM
    @AlemaxM 9 років тому +1

    I open the file and read it, but the problem is when i see the task manager there is excel process like your video when you close two process , who i can close it?, I think that you are not closing the excel file , but I don't have idea how to close it. Can you understand me?. Nice video :). Greetings

    • @Nechytailo
      @Nechytailo 6 років тому

      var myFile = System.IO.File.Create(path);
      myFile.Close();

    • @zhoodarkasymov1774
      @zhoodarkasymov1774 6 років тому

      stackoverflow.com/questions/17777545/closing-excel-application-process-in-c-sharp-after-data-access - here answer on your question

  • @ThunderwavePL
    @ThunderwavePL 8 років тому

    Need I Office program on my computer?

  • @faruksengul5813
    @faruksengul5813 7 років тому

    I could not refer to Excel.
    I downloaded nuget.But did not work. Error =" The COM object of type 'Microsoft.Office.Interop.Excel.ApplicationClass' could not be assigned to the interface 'Microsoft.Office.Interop.Excel._Application'. '{000208D5-0000-0000-C000-000000000046}' This operation failed because the QueryInterface call in the COM component for the interface with the IID failed with the following error: The library has not been registered. (HRESULT returned exception: 0x8002801D (TYPE_E_LIBNOTREGISTERED))." Can you help plaese ?

  • @nestormatias217
    @nestormatias217 8 років тому

    works it local but in server error
    Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).

    • @sunmbalsiddiqui9717
      @sunmbalsiddiqui9717 7 років тому

      It is because Microsoft Excel is not installed on your server may be. Installing Microsoft Excel was helpful for me.

  • @vinayakjambhale5985
    @vinayakjambhale5985 5 років тому

    Hello sir, Thanks for this code, but i got an error on line - Excel.Application application = new Excel.Application();
    Error description - Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).
    I have already done with giving permissions to IUSR IISUSER & all stuff.

  • @diogofagundes5622
    @diogofagundes5622 6 років тому

    Thank you, Saved me.

  • @fernandorochaolivera2404
    @fernandorochaolivera2404 6 років тому

    Hi, if i bought you the code it will come with the excel close file ?

  • @AlemaxM
    @AlemaxM 9 років тому

    How I can close the file??, You can see in the video always is open

    • @LearningProgramming
      @LearningProgramming  9 років тому

      +Alemaxxx Please explain more detail.

    • @jclp5
      @jclp5 9 років тому +1

      +Alemaxxx Use workbook.Close(); before return View("Success");

    • @AlemaxM
      @AlemaxM 9 років тому

      +José Carlos Lozano I was trying but that does not work

    • @jclp5
      @jclp5 9 років тому

      +Alemaxxx
      if (excelfile.FileName.EndsWith("xls") || excelfile.FileName.EndsWith("xlsx"))
      {
      string fileName = Path.GetFileName(excelfile.FileName);
      string path = Path.Combine(Server.MapPath("~/Content"), fileName);
      if (System.IO.File.Exists(path))
      System.IO.File.Delete(path);
      excelfile.SaveAs(path);
      //Read data from excel file
      Excel.Application application = new Excel.Application();
      Excel.Workbook workbook = application.Workbooks.Open(path);
      Excel.Worksheet worksheet = workbook.ActiveSheet;
      Excel.Range range = worksheet.UsedRange;
      List listProducts = new List();
      for (int row = 3; row

    • @AlemaxM
      @AlemaxM 9 років тому +1

      That does not work

  • @freesyriancam
    @freesyriancam 8 років тому

    I want to buy this project files

    • @LearningProgramming
      @LearningProgramming  8 років тому

      +Abu Muhamad Please pay 5USD to my paypal account is codeprogramminglanguages@gmail.com, I will share code demo to you

    • @freesyriancam
      @freesyriancam 8 років тому

      +Learning Programming I did, but from another account.
      waiting your mail,
      Thanks

    • @LearningProgramming
      @LearningProgramming  8 років тому

      +Abu Muhamad I shared code demo to you. Please check your gmail. Thanks

  • @parisasaeedi8674
    @parisasaeedi8674 6 років тому +1

    Thank you sooooooo much

  • @MDMizanurRahman89
    @MDMizanurRahman89 6 років тому

    thank you coooooool!

  • @aaronaaronaaron5922
    @aaronaaronaaron5922 6 років тому

    Grat, tuto :)