Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. The Weird and The Wonderful
  4. I failed to predict this one...new csv format

I failed to predict this one...new csv format

Scheduled Pinned Locked Moved The Weird and The Wonderful
helphardwaresecuritylearning
20 Posts 12 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P PIEBALDconsult

    There is no standard for "CSV" other than the de facto standard of "whatever Excel will open". Some of the "CSV"s I get have multiple headers and tables.

    R Offline
    R Offline
    Rob Grainger
    wrote on last edited by
    #11

    There is no standard for "CSV". Yes, there is: Common Format and MIME Type for CSV Files[^]. (Admittedly, its a bit of a post facto standard)

    "If you don't fail at least 90 percent of the time, you're not aiming high enough." Alan Kay.

    P K 2 Replies Last reply
    0
    • R Rob Grainger

      There is no standard for "CSV". Yes, there is: Common Format and MIME Type for CSV Files[^]. (Admittedly, its a bit of a post facto standard)

      "If you don't fail at least 90 percent of the time, you're not aiming high enough." Alan Kay.

      P Offline
      P Offline
      PIEBALDconsult
      wrote on last edited by
      #12

      That is not a standard for CSV outside of a very limited domain.

      1 Reply Last reply
      0
      • R Rob Grainger

        There is no standard for "CSV". Yes, there is: Common Format and MIME Type for CSV Files[^]. (Admittedly, its a bit of a post facto standard)

        "If you don't fail at least 90 percent of the time, you're not aiming high enough." Alan Kay.

        K Offline
        K Offline
        kmoorevs
        wrote on last edited by
        #13

        :thumbsup: I'd send this to my client, but it's already been 'fixed'. btw, I actually saw firsthand how the problematic file (each line is enclosed in double-quotes) is being generated...via a SSRS report having all the values in a single column. :sigh: The real world standard for CSV = 'It opens fine with Excel'. :laugh:

        "Go forth into the source" - Neal Morse

        1 Reply Last reply
        0
        • K kmoorevs

          Duncan Edwards Jones wrote:

          the columns of the rows are being put together in a string variable

          That was my guess as well. It could have been easily handled by the other programmer...he knew it was a problem, hence the phone call to me stating that my import isn't working properly with their new file format. :sigh: C'mon man, the thing won't even open properly in Excel! :laugh:

          "Go forth into the source" - Neal Morse

          T Offline
          T Offline
          Tim Carmichael
          wrote on last edited by
          #14

          If it won't open in Excel, its because Microsoft didn't plan accordingly. Isn't that the general thought process? Microsoft should account for everything?

          K 1 Reply Last reply
          0
          • T Tim Carmichael

            If it won't open in Excel, its because Microsoft didn't plan accordingly. Isn't that the general thought process? Microsoft should account for everything?

            K Offline
            K Offline
            kmoorevs
            wrote on last edited by
            #15

            Oh, it will open in Excel...column A contains comma separated values! :laugh: My comment was that it didn't open properly. :)

            "Go forth into the source" - Neal Morse

            1 Reply Last reply
            0
            • K kmoorevs

              I've been importing from text files, spreadsheets, etc. for over 18 years now. Just when you think you've seen it all a client brings you this: Each line of a *.csv file starts and ends with double-quotes. :omg: Oh yes, we've had handling in place for many years to deal with embedded double-quotes in csv files (generally a sign of formatted numbers)...basically by stripping the formatting between pairs of double-quotes. It's worked great for many years until now...where it unfortunately removed all the commas leaving a big mess...not good! X| Of course, it's my fault! :sigh: It was an easy fix, but I'm still shaking my head over the fact that their programmer who wrote that export told me that he didn't know why it was getting formatted that way, and that it looked fine to him. :| (due to the fact that the double-quotes didn't show up in Excel...nevermind the fact that column A contained a comma-separated list of the items!) I must be getting too old to argue, instantly agreed that it was my problem, fixed, tested, signed, sealed and delivered in < 30 minutes. Jpb security I guess! :laugh:

              "Go forth into the source" - Neal Morse

              F Offline
              F Offline
              Fueled By Decaff
              wrote on last edited by
              #16

              kmoorevs wrote:

              (generally a sign of formatted numbers)

              Wait, what? Quoted text is supposed to be string data, particularly when there are commas in it, not a way of saying 'it's a number, Jim, but not as we know it'. They are really killing that CSV format. I feel your pain.

              K 1 Reply Last reply
              0
              • F Fueled By Decaff

                kmoorevs wrote:

                (generally a sign of formatted numbers)

                Wait, what? Quoted text is supposed to be string data, particularly when there are commas in it, not a way of saying 'it's a number, Jim, but not as we know it'. They are really killing that CSV format. I feel your pain.

                K Offline
                K Offline
                kmoorevs
                wrote on last edited by
                #17

                Fueled By Caffeine wrote:

                Quoted text is supposed to be string data

                Yes, sorry I misquoted! :laugh: Yes, what I meant to say was that we apply special treatment to quoted fields/text where a number is expected but never expected each line to be double-quoted. It basically caused my parsing routine to behave in an unexpected way...not too difficult to fix once you see it coming. :)

                "Go forth into the source" - Neal Morse

                1 Reply Last reply
                0
                • K kmoorevs

                  I've been importing from text files, spreadsheets, etc. for over 18 years now. Just when you think you've seen it all a client brings you this: Each line of a *.csv file starts and ends with double-quotes. :omg: Oh yes, we've had handling in place for many years to deal with embedded double-quotes in csv files (generally a sign of formatted numbers)...basically by stripping the formatting between pairs of double-quotes. It's worked great for many years until now...where it unfortunately removed all the commas leaving a big mess...not good! X| Of course, it's my fault! :sigh: It was an easy fix, but I'm still shaking my head over the fact that their programmer who wrote that export told me that he didn't know why it was getting formatted that way, and that it looked fine to him. :| (due to the fact that the double-quotes didn't show up in Excel...nevermind the fact that column A contained a comma-separated list of the items!) I must be getting too old to argue, instantly agreed that it was my problem, fixed, tested, signed, sealed and delivered in < 30 minutes. Jpb security I guess! :laugh:

                  "Go forth into the source" - Neal Morse

                  E Offline
                  E Offline
                  Ericcodejob
                  wrote on last edited by
                  #18

                  Nothing is more annoying than a "programmer" who can't program or do simple calculations. I would have done the same thing. Arguing with these 'dips' is like talking to a wall. Just fix the darn thing and move on. What sucks even more is when you have to pay them and they send you a word invoice. Like have you heard of technology my friend? Plus no matter how properly you schedule in some of these programmers, they would rather slack off than do the job on time. Like last time we had these guys who were working on a DAW and their sound alogrithm was so off that we didn't even move forward with the project.

                  1 Reply Last reply
                  0
                  • K kmoorevs

                    I've been importing from text files, spreadsheets, etc. for over 18 years now. Just when you think you've seen it all a client brings you this: Each line of a *.csv file starts and ends with double-quotes. :omg: Oh yes, we've had handling in place for many years to deal with embedded double-quotes in csv files (generally a sign of formatted numbers)...basically by stripping the formatting between pairs of double-quotes. It's worked great for many years until now...where it unfortunately removed all the commas leaving a big mess...not good! X| Of course, it's my fault! :sigh: It was an easy fix, but I'm still shaking my head over the fact that their programmer who wrote that export told me that he didn't know why it was getting formatted that way, and that it looked fine to him. :| (due to the fact that the double-quotes didn't show up in Excel...nevermind the fact that column A contained a comma-separated list of the items!) I must be getting too old to argue, instantly agreed that it was my problem, fixed, tested, signed, sealed and delivered in < 30 minutes. Jpb security I guess! :laugh:

                    "Go forth into the source" - Neal Morse

                    realJSOPR Offline
                    realJSOPR Offline
                    realJSOP
                    wrote on last edited by
                    #19

                    Doesn't that simply import each row as a single field per row? Seems to me your code is working.

                    ".45 ACP - because shooting twice is just silly" - JSOP, 2010
                    -----
                    You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
                    -----
                    When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

                    K 1 Reply Last reply
                    0
                    • realJSOPR realJSOP

                      Doesn't that simply import each row as a single field per row? Seems to me your code is working.

                      ".45 ACP - because shooting twice is just silly" - JSOP, 2010
                      -----
                      You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
                      -----
                      When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

                      K Offline
                      K Offline
                      kmoorevs
                      wrote on last edited by
                      #20

                      John Simmons / outlaw programmer wrote:

                      Seems to me your code is working.

                      Getting one field where multiple fields are expected was a problem. :confused: The original logic was just to remove any commas found between double-quotes. Doing this with the single field (of comma delimited values) just pushed everything together and made a mess. A little added logic to detect if the entire line is wrapped fixed everything. :) Easy. The point was that sometimes you just have to take what the client gives you and make it work...that and how lazy (or stupid) the client's dev was for not understanding what the problem was. :)

                      "Go forth into the source" - Neal Morse

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups