• Resolved kaizerc

    (@kaizerc)


    So I tried to change from “,” to “;” since I have alot of “,” in my data (embed video codes etc…).

    line 380

    foreach ($lines as $line) {
                    $data[] = str_getcsv($line, ';', '"');

    and

    line 390

    while (($r = fgetcsv($handle, 999999, ';', '"')) !== false) {
                    $data[] = $r;

    but still delimits on “,”. Something I’m missing?

    https://www.ads-software.com/extend/plugins/csv-importer/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor dvkob

    (@dvkob)

    kaizerc: I can’t tell you what’s wrong without seeing your data. You can still use comma as a delimiter even when you have a lot of commas in your data if your CSV file is properly escaped. Excel and OO Calc quote field values to distinguish commas used as a delimiters from commas in text.

    Thread Starter kaizerc

    (@kaizerc)

    Thank you for the quick response dvkob, seems I didn’t escape when I exported from phpMyadmin. I tried again with default settings in xampp/phpmyadmin, and with the changes I noted above.

    Here’s how my data looks now:

    "csv_post_title","csv_post_post","csv_post_excerpt","csv_post_categories","csv_post_tags","csv_post_date"
    "Dog running around";"<object width=\"510\" height=\"400\" classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" ><param name=\"quality\" value=\"high\" /><param name=\"bgcolor\" value=\"#000000\" /><param name=\"allowScriptAccess\" value=\"always\" /><param name=\"movie\" value=\"https://static.site.com/swf/flv_player_site_v4.swf\" /><param name=\"allowFullScreen\" value=\"true\" /><param name=\"flashvars\" value=\"id_video=70702\" /><embed src=\"https://static.site.com/swf/flv_player_site_v4.swf\" allowscriptaccess=\"always\" width=\"510\" height=\"400\" menu=\"false\" quality=\"high\" bgcolor=\"#000000\" allowfullscreen=\"true\" flashvars=\"id_video=70702\" type=\"application/x-shockwave-flash\" pluginspage=\"https://www.macromedia.com/go/getflashplayer\" /></object>";"https://img100.site.com/videos/thumbs/4/1/b/41bcd8de9f8b0abd498fdee29a6e5dca.19.jpg";"happy, dog running";"happy, dog running";"2010-01-01 14:00:00"
    "Monkey eating banana";"<object width=\"510\" height=\"400\" classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" ><param name=\"quality\" value=\"high\" /><param name=\"bgcolor\" value=\"#000000\" /><param name=\"allowScriptAccess\" value=\"always\" /><param name=\"movie\" value=\"https://static.site.com/swf/flv_player_site_v4.swf\" /><param name=\"allowFullScreen\" value=\"true\" /><param name=\"flashvars\" value=\"id_video=72784\" /><embed src=\"https://static.site.com/swf/flv_player_site_v4.swf\" allowscriptaccess=\"always\" width=\"510\" height=\"400\" menu=\"false\" quality=\"high\" bgcolor=\"#000000\" allowfullscreen=\"true\" flashvars=\"id_video=72784\" type=\"application/x-shockwave-flash\" pluginspage=\"https://www.macromedia.com/go/getflashplayer\" /></object>";"https://img100.site.com/videos/thumbs/4/9/f/49f300a57e19a071ca1a0a2173e44179.1.jpg";"monkey, eating, banana";"monkey, eating, banana";"2010-01-01 14:00:00"

    Is it a problem that I don’t have all the fields? Looks like the ones I don’t have get set to a default value, which is fine.

    Heres how my posts look:

    TITLE
    "Dog running around";"<object width=\"510\" height=\"400\" classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,
    POST_CONTENT
    0,
    EXCERPT
    0,
    CATEGORIES etc...
    0\" ><param name=\"quality\" value=\"high\" /><param name=\"bgcolor\" value=\"#000000\" /><param name=\"allowScriptAccess\" value=\"always\" /><param name=\"movie\" value=\"https://static.site.com/swf/flv_player_site_v4.swf\" /><param name=\"allowFullScreen\" value=\"true\" /><param name=\"flashvars\" value=\"id_video=70702\" /><embed src=\"https://static.site.com/swf/flv_player_site_v4.swf\" allowscriptaccess=\"always\" width=\"510\" height=\"400\" menu=\"false\" quality=\"high\" bgcolor=\"#000000\" allowfullscreen=\"true\" flashvars=\"id_video=70702\" type=\"application/x-shockwave-flash\" pluginspage=\"https://www.macromedia.com/go/getflashplayer\" /></object>";"https://img100.site.com/videos/thumbs/4/1/b/41bcd8de9f8b0abd498fdee29a6e5dca.19.jpg";"happy, dog running";"happy, dog running";"2010-01-01 14:00:00"

    default settings in xampp: https://i.imgur.com/UOWGa.jpg

    Thank you for your time and your work!

    Plugin Contributor dvkob

    (@dvkob)

    Most columns and values in the file are optional. Either csv_post_title or csv_post_post is necessary and sufficient to create a post.

    https://www.ads-software.com/extend/plugins/csv-importer/other_notes/

    You might want to try setting “Fields escaped by” option to “.

    Thread Starter kaizerc

    (@kaizerc)

    Thank you again dvkob! I tried exporting as “CSV for MS Excel”
    and it worked perfectly. All I did was delete “NULL” from the “Replace NULL by” field!

    (That is for XAMPP, on windows.)

    awesome stuff.

    hello dvkob
    same problem here; I’m trying to import some text content and need to change the delimiter (maybe to “|” (pipe)?

    I’m not able to add the “” on each field (or maybe I suck at excel exporting)…

    Here’s a sample:

    csv_post_title,csv_post_post,csv_post_excerpt,csv_post_categories,csv_post_tags,csv_post_date,csv_post_author,csv_post_slug,custom1,custom2,custom3,custom4
    some title,"<img alt=""some title"" title=""some title"" src=""someimage.jpg"" width=""180"" class=""left"" /> It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.",excerpt(containing commas itself:,,,,),category,tag,date,,,custom1,custom2,custom3,custom4

    usually post stops at the first comma in content, and messes up all the other stuff (custom fields and similar…)

    What I’m doing wrong? or, is there a way to add a pipe as delimiter?

    thanks a lot for your support! ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Plugin: CSV Importer] Change delimiter’ is closed to new replies.