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 Soapbox
  4. Dear Excel

Dear Excel

Scheduled Pinned Locked Moved The Soapbox
20 Posts 9 Posters 1 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.
  • G GuyThiebaut

    I know you really don't want to hear this but - never ever ever ever use excel to open a csv file then save in csv format. I learnt some time ago as you have about the terrible tendency of excel to think it knows better when it comes to csv files. This is a known issue with excel - well for those who know about it anyway ... :sigh: If you need to use an office program with csv files - use Access to read in the csv file and format it for excel...

    Continuous effort - not strength or intelligence - is the key to unlocking our potential.(Winston Churchill)
    L Offline
    L Offline
    Lost User
    wrote on last edited by
    #7

    What I really want is a column based editor that doesn't attempt to format anything. What I was trying to achieve was this; A .csv with six hundred thousand rows and 40ish columns. Another .csv with a similar number of rows and 1 column. The one column needed to replace one of the columns in the original file. I could write something to do that, but I stupidly thought that I could open both, select and copy a column from one and then paste it over a column in the other before saving. Of course I can do that. It is just the content gets changed whilst I'm doing it.

    Every man can tell how many goats or sheep he possesses, but not how many friends.

    G J L 3 Replies Last reply
    0
    • L Lost User

      What I really want is a column based editor that doesn't attempt to format anything. What I was trying to achieve was this; A .csv with six hundred thousand rows and 40ish columns. Another .csv with a similar number of rows and 1 column. The one column needed to replace one of the columns in the original file. I could write something to do that, but I stupidly thought that I could open both, select and copy a column from one and then paste it over a column in the other before saving. Of course I can do that. It is just the content gets changed whilst I'm doing it.

      Every man can tell how many goats or sheep he possesses, but not how many friends.

      G Offline
      G Offline
      GuyThiebaut
      wrote on last edited by
      #8

      Not the most elegant way - but if you have Microsoft Access try using Access to do this. It comes with an import wizard which will let you specify the column delimitation and column type. Oracle PL/SQL Developer and SQL Server also both have wizards to import csv data... Excel just gets too clever sometimes...

      Continuous effort - not strength or intelligence - is the key to unlocking our potential.(Winston Churchill)
      L 1 Reply Last reply
      0
      • G GuyThiebaut

        Not the most elegant way - but if you have Microsoft Access try using Access to do this. It comes with an import wizard which will let you specify the column delimitation and column type. Oracle PL/SQL Developer and SQL Server also both have wizards to import csv data... Excel just gets too clever sometimes...

        Continuous effort - not strength or intelligence - is the key to unlocking our potential.(Winston Churchill)
        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #9

        Just checked, I do have Access. It is nearly 11 years since I had anything to do with that. And that was only fleetingly. I spent far more time with Lotus Approach. Think I'll write a csv editor that acts dumb.

        Every man can tell how many goats or sheep he possesses, but not how many friends.

        1 Reply Last reply
        0
        • L Lost User

          What I really want is a column based editor that doesn't attempt to format anything. What I was trying to achieve was this; A .csv with six hundred thousand rows and 40ish columns. Another .csv with a similar number of rows and 1 column. The one column needed to replace one of the columns in the original file. I could write something to do that, but I stupidly thought that I could open both, select and copy a column from one and then paste it over a column in the other before saving. Of course I can do that. It is just the content gets changed whilst I'm doing it.

          Every man can tell how many goats or sheep he possesses, but not how many friends.

          J Offline
          J Offline
          Joan M
          wrote on last edited by
          #10

          You can use ultraedit[^]: - you can activate the column mode. - you can set some macros that would replace the "," for n tabs. - you can select the columns freely and paste them into excel. All done! :thumbsup: Not the best, but if you are not lucky with excel neither with access...

          [www.tamelectromecanica.com] Robots, CNC and PLC machines for grinding and polishing.

          1 Reply Last reply
          0
          • L Lost User

            What I really want is a column based editor that doesn't attempt to format anything. What I was trying to achieve was this; A .csv with six hundred thousand rows and 40ish columns. Another .csv with a similar number of rows and 1 column. The one column needed to replace one of the columns in the original file. I could write something to do that, but I stupidly thought that I could open both, select and copy a column from one and then paste it over a column in the other before saving. Of course I can do that. It is just the content gets changed whilst I'm doing it.

            Every man can tell how many goats or sheep he possesses, but not how many friends.

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #11

            If you reformat the column using custom format "00000000" and then save as CSV you will get your leading zeros back. Alternatively you could change the file extensions to txt and then when you import them into Excel ensure that the column with the leading zeroes is treated as text.

            The best things in life are not things.

            1 Reply Last reply
            0
            • L Lost User

              Leave my formatting alone you utter, utter cunt.

              Every man can tell how many goats or sheep he possesses, but not how many friends.

              A Offline
              A Offline
              AspDotNetDev
              wrote on last edited by
              #12

              Open the CSV in Notepad++, select all + copy, create new Excel document, paste, Data > Text to Columns, Comma Delimeter, select column with leading zero numbers, set column data format to "Text", press "Finish" to exit wizard and you are done (leading zeroes will be maintained).

              Martin Fowler wrote:

              Any fool can write code that a computer can understand. Good programmers write code that humans can understand.

              1 Reply Last reply
              0
              • L Lost User

                Leave my formatting alone you utter, utter cunt.

                Every man can tell how many goats or sheep he possesses, but not how many friends.

                S Offline
                S Offline
                Sahir Shah
                wrote on last edited by
                #13

                The easiset way to do this is to use the data import wizard. Open a blank workbook and select Data|Get External Data|From Text in the menu bar. In the last step, change the data type from "General" to "Text" for the columns you want to preserve the leading zeroes.

                L'enfer, c'est les autres - Jean-Paul Sartre
                Und wenn du lange in einen abgrund blickst, blickt der Abgrund auch in dich hinein - Friedrich Nietzsche

                G 1 Reply Last reply
                0
                • L Lost User

                  Leave my formatting alone you utter, utter cunt.

                  Every man can tell how many goats or sheep he possesses, but not how many friends.

                  M Offline
                  M Offline
                  Mycroft Holmes
                  wrote on last edited by
                  #14

                  I can see a need for a csv editor tool. How often do we resort to excel to view, manipulate or otherwise open a csv file. Odds are if it contains numerics or even worst dates your screwed, you need to rat through that bloody ribbon thingy to try and find out how to format the column. I HATE EXCEL - let me emphasize that I HATE EXCEL

                  Never underestimate the power of human stupidity RAH

                  G 1 Reply Last reply
                  0
                  • L Lost User

                    Leave my formatting alone you utter, utter cunt.

                    Every man can tell how many goats or sheep he possesses, but not how many friends.

                    P Offline
                    P Offline
                    Peter_in_2780
                    wrote on last edited by
                    #15

                    I'd approach such a problem armed with UltraEdit[^] Its column mode is ideal for such slice'n'dice operations. I don't know if they still have a free version - I paid up about 6 years ago, and took a couple of the free upgrades, then let it sit at version 13. Still in daily use. And yes, I do drag CSVs into and out of Excel from time to time. The import/change column format trick Sahir Shar mentioned above works for me in these cases. Cheers, Peter

                    Software rusts. Simon Stephenson, ca 1994.

                    1 Reply Last reply
                    0
                    • M Mycroft Holmes

                      I can see a need for a csv editor tool. How often do we resort to excel to view, manipulate or otherwise open a csv file. Odds are if it contains numerics or even worst dates your screwed, you need to rat through that bloody ribbon thingy to try and find out how to format the column. I HATE EXCEL - let me emphasize that I HATE EXCEL

                      Never underestimate the power of human stupidity RAH

                      G Offline
                      G Offline
                      GuyThiebaut
                      wrote on last edited by
                      #16

                      Mycroft Holmes wrote:

                      How often do we resort to excel to view, manipulate or otherwise open a csv file

                      I have learnt to not use csv files and to discourage others from sending them to me. I now use pipe delimited files which Excel can manage very easily - other than that tab delimited is a very good choice. I think that the csv file format, despite it being very popular is probably not the best choise of file delimiter - as anything containing an address will have a comma that may not be handled correctly by the machine handling the csv file. I use Excel daily and it is a brilliant piece of software for analysing and graphing data - the pivot tables/graphs are a godsend. However Excel is shite with csv files - part of the reason is that there are different rules for how to process csv files(there must be an ISO standard... which nobody keeps to) and Microsoft use a set of rules that tend to mess with csv files.

                      Continuous effort - not strength or intelligence - is the key to unlocking our potential.(Winston Churchill)
                      M L 2 Replies Last reply
                      0
                      • G GuyThiebaut

                        Mycroft Holmes wrote:

                        How often do we resort to excel to view, manipulate or otherwise open a csv file

                        I have learnt to not use csv files and to discourage others from sending them to me. I now use pipe delimited files which Excel can manage very easily - other than that tab delimited is a very good choice. I think that the csv file format, despite it being very popular is probably not the best choise of file delimiter - as anything containing an address will have a comma that may not be handled correctly by the machine handling the csv file. I use Excel daily and it is a brilliant piece of software for analysing and graphing data - the pivot tables/graphs are a godsend. However Excel is shite with csv files - part of the reason is that there are different rules for how to process csv files(there must be an ISO standard... which nobody keeps to) and Microsoft use a set of rules that tend to mess with csv files.

                        Continuous effort - not strength or intelligence - is the key to unlocking our potential.(Winston Churchill)
                        M Offline
                        M Offline
                        Mycroft Holmes
                        wrote on last edited by
                        #17

                        I don't have a problem with the delimiter, don't really care for tab being a non visual character. My problem is the changing of the format of the data. Try importing a file with 12 character numerics and immediately export it stupid program formats the numbers to engineering format. Just on of many issues I have with excel as a ETL medium. Granted it is an excellent spreadsheet - DD swears by it but we need a tool to manage CSV files ONLY.

                        Never underestimate the power of human stupidity RAH

                        1 Reply Last reply
                        0
                        • G GuyThiebaut

                          Mycroft Holmes wrote:

                          How often do we resort to excel to view, manipulate or otherwise open a csv file

                          I have learnt to not use csv files and to discourage others from sending them to me. I now use pipe delimited files which Excel can manage very easily - other than that tab delimited is a very good choice. I think that the csv file format, despite it being very popular is probably not the best choise of file delimiter - as anything containing an address will have a comma that may not be handled correctly by the machine handling the csv file. I use Excel daily and it is a brilliant piece of software for analysing and graphing data - the pivot tables/graphs are a godsend. However Excel is shite with csv files - part of the reason is that there are different rules for how to process csv files(there must be an ISO standard... which nobody keeps to) and Microsoft use a set of rules that tend to mess with csv files.

                          Continuous effort - not strength or intelligence - is the key to unlocking our potential.(Winston Churchill)
                          L Offline
                          L Offline
                          Lost User
                          wrote on last edited by
                          #18

                          GuyThiebaut wrote:

                          I now use pipe delimited files

                          GuyThiebaut wrote:

                          as anything containing an address will have a comma that may not be handled correctly

                          Bloke at the last place I worked used pipe delimiter for everything he wrote. That was fine until someone used a pipe in an address. When I was creating files that were only ever going to be used by programs then I used CHR(3) as a delimiter.

                          Every man can tell how many goats or sheep he possesses, but not how many friends.

                          G 1 Reply Last reply
                          0
                          • L Lost User

                            GuyThiebaut wrote:

                            I now use pipe delimited files

                            GuyThiebaut wrote:

                            as anything containing an address will have a comma that may not be handled correctly

                            Bloke at the last place I worked used pipe delimiter for everything he wrote. That was fine until someone used a pipe in an address. When I was creating files that were only ever going to be used by programs then I used CHR(3) as a delimiter.

                            Every man can tell how many goats or sheep he possesses, but not how many friends.

                            G Offline
                            G Offline
                            GuyThiebaut
                            wrote on last edited by
                            #19

                            I was asked what the best delimiter was recently and I said "a database"... The room went silent - either because they thought I was a pretentious geek or because in the end databases are probably the best way to exchange data. Or xml files...

                            Continuous effort - not strength or intelligence - is the key to unlocking our potential.(Winston Churchill)
                            1 Reply Last reply
                            0
                            • S Sahir Shah

                              The easiset way to do this is to use the data import wizard. Open a blank workbook and select Data|Get External Data|From Text in the menu bar. In the last step, change the data type from "General" to "Text" for the columns you want to preserve the leading zeroes.

                              L'enfer, c'est les autres - Jean-Paul Sartre
                              Und wenn du lange in einen abgrund blickst, blickt der Abgrund auch in dich hinein - Friedrich Nietzsche

                              G Offline
                              G Offline
                              ghle
                              wrote on last edited by
                              #20

                              Yes, and change the file extension from CSV to TXT to ease things along.

                              Gary

                              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