+ Reply to Thread
Results 1 to 15 of 15

How to convert excel file into csv format with no changes on the comma placement?

  1. #1
    Registered User
    Join Date
    08-01-2012
    Location
    Scotland
    MS-Off Ver
    Excel 2007
    Posts
    10

    How to convert excel file into csv format with no changes on the comma placement?

    How to convert excel file into csv format with no changes on the comma placement of the values in the cells?

    The problem is when I save the xls file into csv format the comma placement changes. For instance:

    xls format: 1870,1876,1900,1924 (the correct format)
    csv format: 1,870,187,619,001,924

    How can I fix this without the need to do it manually?

    I badly need your help. Any assistance will be highly appreciated.

    Thank you!

  2. #2
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,072

    Re: How to convert excel file into csv format with no changes on the comma placement?

    Wow, how is that happening?!? In the xls file, are those values in individual cells or in the same cell (or grouped somehow)? Are you doing a routine "Save As" to get it into CSV format?
    ChemistB
    My 2

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Registered User
    Join Date
    08-01-2012
    Location
    Scotland
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: How to convert excel file into csv format with no changes on the comma placement?

    The values 1870,1876,1900,1924 are on the same cell. To clearly illustrate:

    xls format:
    A B
    1 1870,1876,1900,1924
    2 1870,1876,1900,1924


    csv format:
    A B
    1 1,870,187,619,001,920
    2 1,870,187,619,001,920

    I just used "Save As" and that is the result. I also tried online file converter and the result is the still the same. The comma placement changes. Can you help me on this problem?
    Last edited by Cutter; 08-01-2012 at 02:47 PM. Reason: Removed whole post quote

  4. #4
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,072

    Re: How to convert excel file into csv format with no changes on the comma placement?

    What a CSV format does is put comma's between cells. It's looking at it as one big number in the same cell so it is using commas as thousands separators.
    You need to move these values to separate cells first. This is easy.
    If the columns to the right are not empty, insert 3 blank columns. Then go to data tab on the ribbon > Text to columns
    Check "delimited" > Next
    Check comma> Finish
    Now you can save as a CSV
    Did that work for you?

  5. #5
    Registered User
    Join Date
    08-01-2012
    Location
    Scotland
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: How to convert excel file into csv format with no changes on the comma placement?

    Sorry but it didn't... I need the values to be on the same cell (CELL B). The format must be:

    A B
    1 1870,1876,1900,1924
    2 1870,1876,1900,1924

    BUT IN CSV FILE. How can I do that?
    Last edited by Cutter; 08-01-2012 at 02:46 PM. Reason: Removed whole post quote

  6. #6
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,072

    Re: How to convert excel file into csv format with no changes on the comma placement?

    Hmmmm, I will ask around.

  7. #7
    Registered User
    Join Date
    08-01-2012
    Location
    Scotland
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: How to convert excel file into csv format with no changes on the comma placement?

    I badly need to solve this problem for my work. Thank you very much. I deeply appreciate your help.
    Last edited by Cutter; 08-01-2012 at 02:46 PM. Reason: Removed whole post quote

  8. #8
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,072

    Re: How to convert excel file into csv format with no changes on the comma placement?

    Try this
    Select Column B, then CNTRL +H (find and replace)
    Find ,
    Replace with , (that's a comma followed by a space)
    Replace All
    Then save as a CSV.
    Did that work?

  9. #9
    Registered User
    Join Date
    08-01-2012
    Location
    Scotland
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: How to convert excel file into csv format with no changes on the comma placement?

    I owe you big time...its working! Thank you very much for the help ChemistB. However, is there any other way? The output must really look like this format: (no spaces between the value and the comma.

    A B
    1 1870,1876,1900,1924
    2 1870,1876,1900,1924
    Last edited by Cutter; 08-01-2012 at 02:45 PM. Reason: Removed whole post quote

  10. #10
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    12,649

    Re: How to convert excel file into csv format with no changes on the comma placement?

    The thing you have to remember is that a CSV file is not a specialized file format. It is an extension we assign to regular ASCII text files in which commas are used to separate fields. A few notes:

    1) Since it appears that you have it correctly in Excel at the "beginning", that suggests to me that you have done something (an apostrophe at the beginning of the cell maybe?) to tell Excel that that cell contains text that could possibly be (but you don't want it to be) interpreted as a number. When you save as a CSV file (or other ascii text file), the information Excel needs to know this is supposed to be text gets lost.

    One step I use in debugging this sort of problem is to read the file using a regular text editor (like notepad). When you open a CSV file in Excel, you get Excel's interpretation of what the file contains. When you open a CSV file in a text editor, you see the file without "interpretation." When you open your file in a text editor, what do you see? Is this format what you are expecting? If it is not important to be able to open the file in Excel, this will be a better picture of what the CSV file looks like and whether it will work in the destination application.

    2) As I noted, when you open a CSV file in Excel using the file - open command, it tries to make sense of the fields as best it can, which is sometimes wrong. If it really is important for Excel to read the file correctly, you might try opening the file using the import external data command. This will bring up the text import wizard which will allow you to specify to Excel that the column in question is to be imported as text rather than the default "general" with its tendency to identify numbers where possible.

  11. #11
    Registered User
    Join Date
    08-01-2012
    Location
    Scotland
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: How to convert excel file into csv format with no changes on the comma placement?

    Thank you for the explanation MrShorty. Can you please give me a step by step process on how to have this format on csv file?

    The output must be:

    A B
    1 1870,1876,1900,1924
    2 1870,1876,1900,1924
    Last edited by AnnaMarie88; 08-01-2012 at 03:01 PM. Reason: Removed whole post quote

  12. #12
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: How to convert excel file into csv format with no changes on the comma placement?

    Hello AnnaMarie88, and welcome to the forum.

    Please notice that I have removed whole post quotes from your posts(s). Please read the following forum rule and keep it in mind for your future posts. Thanks.

    Rule 12. Don't quote whole posts -- it's just clutter. If you are responding to a post out of sequence, limit quoted content to a few relevant lines that makes clear to whom and what you are responding.

  13. #13
    Registered User
    Join Date
    08-01-2012
    Location
    Scotland
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: How to convert excel file into csv format with no changes on the comma placement?

    Noted! Thanks for the reminder Cutter.

  14. #14
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    12,649

    Re: How to convert excel file into csv format with no changes on the comma placement?

    I don't think I can give a specific procedure, because I'm not sure I understand all of your requirements.

    How important is it that the entire text string be in one cell in Excel? Is this what each record should look like in the text file?
    Please Login or Register  to view this content.
    The easiest way I know to create CSV files from Excel is, like ChemistB suggested, to have each value in its own cell. Then Excel will supply the commas when you do the save as.

  15. #15
    Forum Guru martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: How to convert excel file into csv format with no changes on the comma placement?

    i dont see the problem,save as csv then open in notepad it looks ok, its only when you open it directly in excel it changes.
    change .csv to .txt, open with excel and change the field to text its ok
    Last edited by martindwilson; 08-03-2012 at 07:12 PM.
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1