+ Reply to Thread
Results 1 to 11 of 11

Problems with CSV import due to comma in string

  1. #1
    Registered User
    Join Date
    02-06-2018
    Location
    Copenhagen, Denmark
    MS-Off Ver
    2016
    Posts
    29

    Problems with CSV import due to comma in string

    Hi guys,

    I have a issue when importing .CSV file to Excel due to delimeter being a comma, but one of the values also has a comma included.

    How the data looks in the .CSV file
    "Level", "Type Name"
    "Level K2, #6399175", "Type 1"

    The trouble is with this value "Level K2, #6399175".

    When importing this is what comes out. See picture 1.

    How it should look. See picture 2.

    Could someone please explain what to do? I mean the delimeter is a comma, but how do I overcome that the value "Level K2, #6399175" includes a comma (as marked)
    Attached Images Attached Images

  2. #2
    Registered User
    Join Date
    02-06-2018
    Location
    Copenhagen, Denmark
    MS-Off Ver
    2016
    Posts
    29

    Re: Problems with CSV import due to comma in string

    Actually the comma I described before is not the problem rather it is because the value is "Level "K2", #6399175". So the problem is the marked: "Level "K2", #6399175"

    I don't think there is a quick fix for this

  3. #3
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Problems with CSV import due to comma in string

    any chance for example csv file?

  4. #4
    Registered User
    Join Date
    02-06-2018
    Location
    Copenhagen, Denmark
    MS-Off Ver
    2016
    Posts
    29

    Re: Problems with CSV import due to comma in string

    Here you go
    Attached Files Attached Files

  5. #5
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Problems with CSV import due to comma in string

    hm, could you change delimiter definition edit: is it possible to change the delimiter to a character that does not exist in the data before export to csv? eg. @ or any other character which doesn't exist in your data

    testcsv.jpg
    Last edited by sandy666; 07-19-2018 at 10:22 AM.

  6. #6
    Registered User
    Join Date
    02-06-2018
    Location
    Copenhagen, Denmark
    MS-Off Ver
    2016
    Posts
    29

    Re: Problems with CSV import due to comma in string

    I suppose it is possible, but how would that help? Since the comma in the value would then also be changed to @ and then the same would happen I suppose?

  7. #7
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Problems with CSV import due to comma in string

    comma in the value will not be changed if csv will be genersted properly.
    software should know what is delimiter and what isn't
    as you can see on the picture example @ divided csv correctly and now will be easier to clean data from unnecessary characters or something what you want to do.

    to be clear I am not saying about replace in notepad

    you are very economical with your example file, so it's hard to say anything more without representative data

    my favorite saying: Excel can do everything but still doesn't read user's wishful thinking
    Last edited by sandy666; 07-19-2018 at 04:39 PM.

  8. #8
    Registered User
    Join Date
    02-06-2018
    Location
    Copenhagen, Denmark
    MS-Off Ver
    2016
    Posts
    29

    Re: Problems with CSV import due to comma in string

    Yes I get what you are saying now. However I don't control the software from which the CSV is generated. It uses commas as delimiters.

  9. #9
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Problems with CSV import due to comma in string

    So use any plain text editor (hope NOT ms word) and use regex to change default delimiter (comma) to any unique character

    Regular expression - regex

  10. #10
    Registered User
    Join Date
    02-06-2018
    Location
    Copenhagen, Denmark
    MS-Off Ver
    2016
    Posts
    29

    Re: Problems with CSV import due to comma in string

    Could you give me some example of plain text editors?

  11. #11
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Problems with CSV import due to comma in string

    sure...
    Notepad++ (free)
    EditPadLite (free for personal use)
    RegexBuddy
    PowerGrep
    UltraEdit
    EditPadPro

    I suggest Notepad++ - free and useful (features)

    Always work on copy of your original file!
    Last edited by sandy666; 07-19-2018 at 05:28 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Substitute alphanumeric string into a comma separated string
    By icyrius in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 06-09-2017, 07:16 AM
  2. Import from *.csv cuts off digits after comma
    By mary26 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-19-2015, 12:52 PM
  3. how to Get all Strings Except last string in comma sepated string
    By narasappaj in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-20-2014, 07:05 AM
  4. [SOLVED] CSV file with a comma in some text fields how to import
    By etaf in forum Access Tables & Databases
    Replies: 4
    Last Post: 09-12-2013, 10:54 PM
  5. Import a Comma Deliniated List
    By maroonlover in forum Excel General
    Replies: 2
    Last Post: 05-26-2011, 09:49 AM
  6. CSV comma/semicolon problems
    By Hitch75 in forum Excel General
    Replies: 0
    Last Post: 01-27-2011, 05:05 AM
  7. Change delimiter in import function from comma to tab
    By marksince1984 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-13-2006, 12:40 AM

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