How to Import data from Excel File to Database Table in ASP.NET Core

Поделиться
HTML-код
  • Опубликовано: 18 янв 2025

Комментарии • 54

  • @arshadilahee690
    @arshadilahee690 Год назад

    I cannot thank you enough for this video. Your content has been an absolute lifesaver for me. Your dedication to providing high-quality and informative content is truly remarkable. You've not only helped me complete my task, but you've also expanded my knowledge and skillset.
    Your ability to explain complex topics in a simple and engaging manner is a gift, and it's evident that you genuinely care about your viewers' progress. I've been inspired by your work, and it has encouraged me to explore new areas and improve my skills.
    I look forward to more of your content and eagerly await the knowledge and inspiration you'll continue to share with us. Your efforts have made a significant impact on my life, and I'm immensely grateful for that.
    Thank you once again for your exceptional work. You're a shining example of how a passionate content creator can positively affect the lives of others. Your contributions to the RUclips community are invaluable, and I feel lucky to have found your channel.

  • @Ntandoemk
    @Ntandoemk 2 года назад +1

    Great work my guy. You just saved me a lot of time. Please keep it up!

  • @nikoreva2078
    @nikoreva2078 10 месяцев назад

    Thank you very much! This was very helpful!

  • @chandankarmakar6651
    @chandankarmakar6651 3 года назад

    Thank you so much for this simple but useful video. Keep up the good work.

  • @somyaverma4083
    @somyaverma4083 2 года назад

    Thank you so much it's really very helpful for us

  • @shijimol1083
    @shijimol1083 2 года назад

    Thank you so much sir ,ur code helped me alot thank you do much

  • @lubuntumleto5052
    @lubuntumleto5052 3 года назад

    Thanks mate, clear explanation

  • @VictorMoraesVictorMoraes
    @VictorMoraesVictorMoraes 3 года назад +3

    Hi, and thanks for the demo. I would like to know how I could validate and prevent the upload if my .xlsx spreadsheet didn't have any data. Currently, when I try to import an empty spreadsheet, I get this error: "Object reference not set to an instance of an object." I would like to return an exception if my file is empty.

    • @CsharpSpace
      @CsharpSpace  3 года назад +1

      Count the uploaded excel sheet row before insert into database.

  • @faisalsiswanto4599
    @faisalsiswanto4599 3 года назад +2

    I'm still waiting for connection to DB, its just read file excel right ?

  • @rohitkadam1772
    @rohitkadam1772 2 года назад

    we can use table right instead of list that will make it faster

  • @allahnoorqudosi7472
    @allahnoorqudosi7472 4 года назад

    Thanks, That was very useful

  • @expinntechnologies2782
    @expinntechnologies2782 2 года назад

    Not getting Dimensions Property inside worksheet. Can you assist?

  • @esayasteshomemohammed59
    @esayasteshomemohammed59 3 года назад

    it is your approach that make simple, clear and done . Thank you. after return list, How I used it for display on the view and save to the database. I am beginner.

  • @profex3389
    @profex3389 Год назад

    I am getting this error... in HomeConrtoller line 26 "System.NullReferenceException: "Object reference not set to an instance of an object.""

  • @naveedaltaf2043
    @naveedaltaf2043 2 года назад

    hi bro can i import Excel file using web api c#

  • @theogamesbrasil
    @theogamesbrasil 2 года назад

    great!!!! congratulation!

  • @tahirsrds
    @tahirsrds 3 года назад

    Hi, What about integers or booleans with that format? you have used only string. Thanks

    • @CsharpSpace
      @CsharpSpace  3 года назад

      Add condition for integer and booleans and change into string they display in excel

  • @dineshkalva3884
    @dineshkalva3884 3 года назад

    Great. But if my excel file keep changes along with columns to different tables, how to do that?

  • @osmanturk7867
    @osmanturk7867 2 года назад

    Hello how to print returned list ? :)

  • @shishirdonde
    @shishirdonde 3 года назад +1

    Great Help. Could upload the XL file with ease using your technique. Is there a way we can contact you?

    • @CsharpSpace
      @CsharpSpace  3 года назад

      yes you can contact on may email: dotnetguru93@gmail.com

    • @shishirdonde
      @shishirdonde 3 года назад

      @@CsharpSpace Thanks please check your mail.

  • @coskungulcicek
    @coskungulcicek 3 года назад

    thank you for all

  • @NB_CdR_
    @NB_CdR_ 3 года назад

    sir, what if i want to use colCount as well instead of column number 1, 2, 3.... and use two for loops?? and how can i perform that ??

  • @Manmade_vlogs
    @Manmade_vlogs 3 года назад

    sir why i am getting error while doing list.add(new modelname { field.... } it says identifier expected

    • @CsharpSpace
      @CsharpSpace  3 года назад

      Try to debug code with break point and find the exact error

  • @shaumikghosh8364
    @shaumikghosh8364 3 года назад

    I have folowed your code but i am getting the error IndexOutOfRangeException: Worksheet position out of range. "ExcelWorksheet worksheet = package.Workbook.Worksheets[0]" ,,, do you have any sugession to solve it please?

    • @ronaldmirabal5400
      @ronaldmirabal5400 3 года назад

      Change package.Workbook.Worksheets[0] for package.Workbook.Worksheets[1]

    • @momenalnaser3628
      @momenalnaser3628 2 года назад

      @@ronaldmirabal5400 it didnt work ! , do you ave another wait o solve this

  • @user-zg6rw2qd8p
    @user-zg6rw2qd8p 3 года назад

    Hi, I'm unable to import the excel contents to the Import method. Can you please help? Thank you so much!

  • @alefolegnebayewe6997
    @alefolegnebayewe6997 3 года назад

    Thank you that help!
    how I can insert , update, and delete operation of data from "spreadsheet embed UI viewer" to the data base table. difficult part for me is connection string on the startup, appsettings, controller page, header mapping for now is not difficult for insert, update and delete for sample at you tube.

  • @ngrokilan1987
    @ngrokilan1987 2 года назад

    Hi, thanks for the video. I have a problem when one cell is empty in the Excel. "Object reference not set to an instance of an object.". Exactly using your code, without any change. Help please

    • @naveev.7235
      @naveev.7235 2 года назад +1

      give them default value as string.Empty example ;
      user = (worksheet.Cells[row, 1].Value ?? string.Empty).ToString().Trim()

  • @rezadehghani3626
    @rezadehghani3626 2 года назад

    Hi, It was so helpful thanks a lot. Now, How can I save it in the database?

  • @mitalijain2410
    @mitalijain2410 3 года назад

    Hey, I liked the video.. I had a small query.. I have multiple sheets in one excel.. So how do I import one particular sheet only?

    • @CsharpSpace
      @CsharpSpace  3 года назад

      Try to define sheet no in your code,

    • @somyaverma4083
      @somyaverma4083 2 года назад

      Hey , I have to do same task.....so how can I insert multiple sheet data in database

  • @tirmovies399
    @tirmovies399 2 года назад

    Hi thank you so much, this video help me a lot. But anyway, how if my field value is enum, how can I import it?

  • @coskungulcicek
    @coskungulcicek 3 года назад

    hello, how can ı pass null the rows ?

  • @samuelojekunle8760
    @samuelojekunle8760 4 года назад

    Thank you for this
    please how can i view the data in the index before uploading it to the database in a table

    • @CsharpSpace
      @CsharpSpace  4 года назад

      Bind the converted list into index view before send to database

  • @JevLogin
    @JevLogin 2 года назад

    No read excel file... file==null

  • @meghnasolanki8602
    @meghnasolanki8602 3 года назад

    It would be great if u provide the code for this.

  • @JevLogin
    @JevLogin 2 года назад +1

    System.NullReferenceException: "Object reference not set to an instance of an object."

  • @vicsaisan4349
    @vicsaisan4349 2 года назад

    Nice tutorial. how to return a view instead of having return list?

  • @sudhakark1909
    @sudhakark1909 3 года назад

    Licence file exception

  • @richbrescher6544
    @richbrescher6544 3 года назад

    How do I connect import to a Sql Server database?