• Resolved Fred Atkinson

    (@fatkinson)


    I am now at a point with Link Library where I am ready to import link information from a database of links that I have on hand.

    That database has a large number of links in it. To input them one by one would be very time consuming.

    I exported that database in CSV format. Here is a small portion of the output:

    “callsign”;”sortcode”;”url”;”count”
    “AH0A”;”0A##AH”;”www.ah0a.org”;”0″
    “W0AA”;”0AA#W#”;”www.w0aa.org”;”0″
    “W0ABR”;”0ABRW#”;”www.w0abr.com”;”0″

    Obviously, I am going to have to edit the entire CSV file accordingly to achieve this. I see [under Global Options, Import/Export Links] that there is an option to ‘Import Links from CSV’ by uploading a text file.

    Here are the mechanics of the issue [as I see them]:

    The ‘callsign’ value should be imported as the ‘Add Title’ field.

    The ‘sortcode’ value should be imported as the ‘Custom Text Field #1’ which I have also named ‘sortcode’.

    The ‘url’ value should be imported as the ‘Web Address’ field.

    The ‘count’ field is superfluous. I do not need to import that value.

    If I can import that database of my links into Link Library, the most difficult part of this process is over!

    Any suggestions are welcome.

    The page I need help with: [log in to see the link]

Viewing 15 replies - 1 through 15 (of 23 total)
  • Plugin Author Yannick Lefebvre

    (@jackdewey)

    Hi Fred, First things is that you will need to replace the semi-colons between fields for commas, as Link Library expects only commas between fields. You will be able to import your data by formatting it this way:

    “Name”,”Custom Text 1″,”Address”,”Category Slugs”,”Category Names”
    “AH0A”,”0A##AH”,”www.ah0a.org”,”call-signs”,”Call Signs”
    “W0AA”,”0AA#W#”,”www.w0aa.org”,”call-signs”,”Call Signs”
    “W0ABR”,”0ABRW#”,”www.w0abr.com”,”call-signs”,”Call Signs”

    As you can see, I removed the count column from the data set and I added two extra columns to hold the name of the category that should be assigned to the new items and the slug version of that category name (all lower case, dashes instead of spaces)

    I tested it here and it worked perfectly. Let me know if this works on your side.

    Thread Starter Fred Atkinson

    (@fatkinson)

    Yannick,

    I was able to redit that CSV file in less than a minute with the search and replace function.

    It imported easily a few minutes after that.

    I am sorting through all of the links one by one to see which ones need editing, hiding, or deletion, etc.. I have a long way to go. But it is much easier to do them from your plugin.

    This is working out great.

    Regards,

    Fred

    Plugin Author Yannick Lefebvre

    (@jackdewey)

    Sounds good. Happy editing! ??

    Thread Starter Fred Atkinson

    (@fatkinson)

    Appreciate your help.
    I am wanting to take this further.
    As soon as I get the database done like I want it, I will probably have some more issues.
    Thanks for your support.

    Thread Starter Fred Atkinson

    (@fatkinson)

    Yannick,

    I need to be able to export my database into a CSV format that includes only three of the fields in my Link Library database for one particular Link Category.

    I tried the export function. There is such an enormous amount of extraneous data that makes it nearly impossible to edit into a usable format [without an extreme amount of work].

    I will then need to import the three fields into a separate MySQL database which will be used by a new plugin that will allow other sites to use that data.

    In this way, I can use Link Library to manage the data before sharing it.

    Can you think of any way that this could be successfully done?

    Regards,

    Fred

    Plugin Author Yannick Lefebvre

    (@jackdewey)

    Hi Fred, Did you try opening the CSV file in a tool like LibreOffice Calc? That spreadsheet editor will allow you to quickly delete the extra columns of data you don’t need and save back the columns you need.

    The alternative would be for you to learn about MySQL querying, then connecting to the phpMyAdmin interface for your web site to extra only the columns you need as a CSV file. I could definitely help with that.

    Thread Starter Fred Atkinson

    (@fatkinson)

    I am not familiar with that particular package.
    But I think I get the idea.
    Could I use Open Office Calc instead?

    Plugin Author Yannick Lefebvre

    (@jackdewey)

    Yes! LibreOffice is a fork of OpenOffice that just gets more updates than the original OpenOffice. Excel does not deal with CSV files well, so I always recommend LibreOffice/OpenOffice.

    Thread Starter Fred Atkinson

    (@fatkinson)

    I imported the CSV file into OpenOffice Calc.
    It wasn’t pretty. Multiple fields were crammed into cells with hoards of comma separators.
    Too complicated to edit with the over a thousand records involved.

    Plugin Author Yannick Lefebvre

    (@jackdewey)

    Ok, so, do you have access to a copy of phpMyAdmin on your web server to be able to run queries on your database?

    Thread Starter Fred Atkinson

    (@fatkinson)

    Oh, yes! I wanted to import it into my external database using that.

    Plugin Author Yannick Lefebvre

    (@jackdewey)

    So, which fields are you looking to export out of your WordPress database? I can write the query for you if it’ll help.

    Thread Starter Fred Atkinson

    (@fatkinson)

    I am looking to export the data from Link Library for my Ham Domains category and then import it into a MySQL database!
    The three fields I am looking to export from Link Library are: callsign, sortcode, and url.
    Once I get the export into a manageable format, I should be able to export it into theMySQL database.

    Plugin Author Yannick Lefebvre

    (@jackdewey)

    select p.post_title, pm1.meta_value as URL, pm2.meta_value as sortcode from wp_posts p, wp_postmeta pm1, wp_postmeta pm2
    where p.ID = pm1.post_id
    and p.ID = pm2.post_id
    and pm1.meta_key = 'link_url'
    and pm2.meta_key = 'link_custom_text_1'

    Something like this will work for you if your table prefix is the default wp_. Replacing wp_ with other prefix if needed.

    Thread Starter Fred Atkinson

    (@fatkinson)

    So, this will export the data in a format contaimmg the fields I am seeking?
    I am working on adapting it to my database. So far, I have not been successful.
    Of course, my MySQL skills are lacking.
    Will keep at ir!

Viewing 15 replies - 1 through 15 (of 23 total)
  • The topic ‘Importing CSV from My Database’ is closed to new replies.