Writing to a CSV File in C# (Simple)

แชร์
ฝัง
  • เผยแพร่เมื่อ 17 ก.ย. 2024

ความคิดเห็น • 57

  • @adityasher
    @adityasher 5 ปีที่แล้ว +7

    man o man love the short way of explaining it, other weblinks were very tough to Understand

  • @lovegruvberg4631
    @lovegruvberg4631 4 ปีที่แล้ว +2

    This tutorial is great! Plain simple and not hard to follow at all, thanks a lot

  • @vincentvalentine9417
    @vincentvalentine9417 4 ปีที่แล้ว +2

    thanks, m8 a lot of times I just need a quick and dirty answer to get me going, then I hash out all the BS later. I really appreciate the not so long-winded response.

  • @danh9676
    @danh9676 5 ปีที่แล้ว +2

    That was quick, easy, and understandable.

  • @twistentiger5610
    @twistentiger5610 4 ปีที่แล้ว +1

    Thanks for this mate, you have made my life easier

  • @paragonpartners2058
    @paragonpartners2058 10 หลายเดือนก่อน

    Thanks, you made it easy for me

  • @Khud0
    @Khud0 3 ปีที่แล้ว

    Awesome, thanks for a very clear and understandable tutorial!

  • @ShareKnowledge76
    @ShareKnowledge76 ปีที่แล้ว

    GREAT article 👍

  • @eastern815
    @eastern815 9 หลายเดือนก่อน

    You are awesome👍

  • @dizmo..
    @dizmo.. 2 ปีที่แล้ว

    Thank you a lot, man! I was doing logs for my calcualtor with csv file. I had a problem with it and the thing was in that parameter in StreamWriter. I didnt now about it, thanks!

  • @simonsah2619
    @simonsah2619 3 หลายเดือนก่อน

    super ty
    :)

  • @Sajibkumarjoarder
    @Sajibkumarjoarder ปีที่แล้ว

    thank you

  • @lukemyles1367
    @lukemyles1367 3 ปีที่แล้ว +1

    Noice wann ..thanks for being a great audience

  • @cyberlacs
    @cyberlacs 5 ปีที่แล้ว +1

    Congratulations on the great video lesson.
    Simple, objective and straightforward.
    Live to Visual Studio and C #
    God is Faithful.
    And the earth remains flat until further notice.
    Thank you very much.

  • @kuldeeptyagi2339
    @kuldeeptyagi2339 2 ปีที่แล้ว

    Nice

  • @youngsolomon9768
    @youngsolomon9768 3 ปีที่แล้ว +1

    how do I add a specific file path

  • @faketetrisbeatboxguy4241
    @faketetrisbeatboxguy4241 4 ปีที่แล้ว +1

    can you do a video on reading the CSV file?

    • @maxodidily
      @maxodidily  4 ปีที่แล้ว

      I have a tutorial on that: th-cam.com/video/iwvJ26DTK3w/w-d-xo.html

  • @coryhobgood
    @coryhobgood 4 ปีที่แล้ว +2

    This helped me to create a .txt. But it's not quite a CSV file. Was looking to create a datatable and output that into a .csv file.

    • @maxodidily
      @maxodidily  4 ปีที่แล้ว

      Just change the file name to have .csv at the end.

    • @billpapa4966
      @billpapa4966 3 ปีที่แล้ว

      @@maxodidily Hey dude, thank you for the tip. I am doing almost the same thing but I am using the user input from a WPF application I made. I store the user input in variables ( userID and telephone) and then insert those to the. CSV file. I don't how to explain it well but apart from only listing the input from the user, it takes "System.Windows.Controls.TextBox: 542384213894 " all of that. The input is the number and the previous thing is probably the textbox. Evidently, I want it to list only the user input. Do you have any idea what might be the cause of this? I implemented my own method but mostly followed your instructions.

    • @wearytrader535
      @wearytrader535 ปีที่แล้ว

      @@maxodidily Insane how simple this solution is lmao. I was going to complain about the same thing, thanks for the tip!

  • @shreyshah8596
    @shreyshah8596 3 ปีที่แล้ว

    Thank you for the wonderful explanation!! but have doubt, where to find the txt file when the app is running on android phone??

  • @sjuesju
    @sjuesju 3 ปีที่แล้ว

    What would happen if in any of the string you have a coma? For example "Mercy" is "Mer,cy"

    • @maxodidily
      @maxodidily  3 ปีที่แล้ว +1

      That would result in unwanted behaviour. If you think your data will need commas, you should use a different character or sequence of characters for your delimiter.

  • @Paul-ug6rs
    @Paul-ug6rs 2 ปีที่แล้ว

    Thx Max, do you know how to delete specific data from csv file?

  • @alexvl4903
    @alexvl4903 3 ปีที่แล้ว

    Hi! I write Cyrillic lines to the file. When I open it, I see the hieroglyphs. How can I change the encoding when saving?

  • @malikjavadov366
    @malikjavadov366 2 ปีที่แล้ว

    danke!

  • @shreyanshparashar1152
    @shreyanshparashar1152 3 ปีที่แล้ว

    sir can you tell me how i can prevent special character in csv or how can i prevent csv injection

  • @kishorkumar.s34
    @kishorkumar.s34 4 ปีที่แล้ว

    This video was really helpful, but what if we need to add header to these values , how to achieve this.

    • @maxodidily
      @maxodidily  4 ปีที่แล้ว +1

      You could just use the first line of the file as header values and when you read from the file, just ignore the first line.

  • @hansshadow360
    @hansshadow360 4 ปีที่แล้ว

    How to add style to cell when export the file?

    • @maxodidily
      @maxodidily  4 ปีที่แล้ว

      @@hansshadow360 Indeed you can, here is a link to a stack overflow page: stackoverflow.com/questions/42500606/formatting-excel-sheet-using-c-the-style-apply-to-all-cells-not-to-one-cell

  • @charysafflickstraker1278
    @charysafflickstraker1278 4 ปีที่แล้ว

    so are we using a console appplication or WFA ?

    • @maxodidily
      @maxodidily  4 ปีที่แล้ว

      This code can be used with either but in this tutorial we use a console application as it is quicker.

  • @mt03adventures
    @mt03adventures 4 ปีที่แล้ว +1

    if you don't close your stream writer it does not work for a .csv file. I mean for me it did not work just after i closed the file. Anyway ty for the video

    • @maxodidily
      @maxodidily  4 ปีที่แล้ว

      You should close the stream writer, I forgot to mention that.

    • @ecerejo
      @ecerejo 4 ปีที่แล้ว +1

      From what I understand you don't have to close when you use the keyword "using" like you did. When you use the keyword using it automatically calls Dispose and Dispose will automatically close the writer also. bit.ly/3bGe1M2

    • @charlesamador3440
      @charlesamador3440 3 ปีที่แล้ว

      What ecerejo said!! I added the "using" part, and the .csv file worked!!

  • @16Flavius
    @16Flavius 4 ปีที่แล้ว +1

    You are writting in a txt file, not a CSV file.....

    • @maxodidily
      @maxodidily  4 ปีที่แล้ว +3

      It does works if you change .txt to .csv

  • @bikrampoudel4848
    @bikrampoudel4848 3 ปีที่แล้ว +1

    what about csv?

    • @DaveLight395
      @DaveLight395 3 ปีที่แล้ว +1

      What do you mean by that ?

    • @bikrampoudel4848
      @bikrampoudel4848 3 ปีที่แล้ว +1

      @@DaveLight395 oh i don't know what did i wanna say at that time 😂 i think i was not quite familiar with CSV at that time 😂

    • @DaveLight395
      @DaveLight395 3 ปีที่แล้ว

      @@bikrampoudel4848 oh ok :D

  • @MrGeorgemoreno
    @MrGeorgemoreno 4 ปีที่แล้ว

    Are those blurred directories porn? Just kidding, thanks for the tutorial (y)

    • @maxodidily
      @maxodidily  4 ปีที่แล้ว +2

      They are directories are called "homework".

    • @0x19
      @0x19 4 ปีที่แล้ว

      @@maxodidily and those folders have actual homework inside???? xD jk great vid

  • @codymckinney4934
    @codymckinney4934 3 ปีที่แล้ว

    can we just get the code to copy and paste :)

  • @omgitispewdiepie4072
    @omgitispewdiepie4072 5 ปีที่แล้ว

    where is your Twitter bot

  • @andrewmcallister3529
    @andrewmcallister3529 9 หลายเดือนก่อน

    Think I'll find a different video, you don't even have file types turned on.

  • @gregplayz1675
    @gregplayz1675 2 ปีที่แล้ว

    how do i write into existing rows

    • @maxodidily
      @maxodidily  2 ปีที่แล้ว

      th-cam.com/video/UF3xwWs4ZvY/w-d-xo.html This tutorial should be what you are looking for.

    • @gregplayz1675
      @gregplayz1675 2 ปีที่แล้ว

      @@maxodidily thanks so much