Build Your Own Business Website header image

Community Library Website Case Study – Part 13 – Import Existing Data Using the CSV Importer Plugin

Difficulty Level -

Filed Under Topics - , , ,

Listed Under Lesson Subjects - ,

Applies to - ,

Whoops, you've found some premium content!

Watch the opening clip of this video to preview it,
the full video is available to paid members.

This is the thirteenth in a series of live lessons on using WordPress and Thesis as a Content Management System (CMS). We are using the CSV Importer plugin to import an existing database from a CSV file. In this step we actually import the data, find an error and restore the database to the pre-import condition. Next, we fix the error and try again.

Video Transcript

Rick: And then we’re going to go back to our website and import it. And it’s not going to work right, I just wanted to go through the process of fixing it once it doesn’t work right once. So if we come down to CSV Importer and we choose a file and we scroll down here to wherever book 1 is. Book1.csv, open that up. Import and in about 12 seconds, we’re going to have something that says it imported. Okay, 1049 posts were inserted and if we come over and look at catalog items, now you can see that we have all of these different posts here. And if we look at patron saints for post moderns, you can see that the book has been selected for the media type. Biography has been selected for locations. No topics were added. It was given an adult… it was given 2 authors: Armstrong and Chris. And then we got a barcode and a call number and an ISBN number and a publication year. And what we didn’t get was a circulation time although we actually did get a circulation time because if you looked down at our custom fields, it shows 14 days. It just doesn’t show up here. But which I don’t think really matters that much.

And so, we’ve got all this data in but this is a mistake. And so, what we have to do is throw this all away, fix our mistake, and reimport it. And so, the way we’re going to do that now is we come back over to Bluehost and we’re at our database. We check all of the database tables. We drop all those database tables. We say yes to that. So now, we have no database tables left in that so all that data is gone. And then what we’re going to do is we’re going to import the data that’s down here that we saved before. And so, we’re just going to choose the file and the file for me is in Downloads and… what’s the name of that file again? I’ve forgotten already. BYOB tuto and so… let’s see… byobtutoword27, this is it. So now we’re going to say go, okay. Now we can look and we’ve got our old database back and if we come back over here to catalog items, we no longer have any catalog items there. But our custom post types, if we look at our manage custom post types, we’ve got that in as we saved it and we’ve got manage taxonomies in as we saved it. And we’ve got our Verve meta boxes in as we saved it. And I had to do this myself. Since you’ve seen me worked this out, you probably won’t have to do this often but really, I had to do this like 15 times in order to get this right. And so, if you do this little backup at this very point, at which you are 100% ready to upload, then you can just get back to this 0 point anytime you want by clearing the database and then restoring the old database.

And so we’re going to fix this file one more time. We’re going to go to this and then go to our author and we’re going to command H and we are going to replace…actually, the first thing we’re going to do is… no. What we’re going to do is we’re going to replace *, *. So that’s this condition, that’s some letter wildcard, a comma, a space and another wildcard and we’re going to replace that condition with semi-colon space. So we replace all of those… no, that’s not what we wanted. Control Z… okay, close. Control Z, okay. Maybe that’s all we have to do. It’s just control H, forget the wildcards and it’s going to be comma space and we’ll replace with semi-colon space. Replace all… okay comma space, replace all. Okay, replaced 210 of them, close. So now we’ve got our semi-colons in there. So now we can save this again, save as… and we’re saving it as book 1 again. Save it… yeah, okay. And now, we’ll import it and it should actually work fine.

So go down to our CSV importer, choose the file… oh it’s on my desktop. Book1.csv, import and hopefully what we’ll have now is a single author name where there is a single author. Okay, we’ve imported 249 posts and now we go back to our catalog item. What ha Christianity every done for us? We hit enter and now we’ve got a book, a non-fiction location, no topics associated with it. We’ve got adult audience and we’ve got Jonathan Hill as the author. And if we wanted to just take a look at topics for a moment and see how many topics have been added to the site, not very many actually. Yeah, these are the only topics that have been added to the site and there are not very many catalogs or items with that. Pam, I’m going to turn your microphone back on. Does that look right? Is that… how many…

Pam: Yes, probably because I’ve just started adding topics. So there’s a lot of… most of the list don’t have topics yet.

Rick: Okay. And so, we’ve got these audience members, we’ve got tons of authors obviously. And we have these media types and these locations. And if we open a catalog item, we have you know, each of these things that can be chosen and added to and that kind of stuff. And so, what we’re going to do next is we’re going to start looking at ways to view these and yeah…I think that’s what’s next. You know, look at ways to view them. So let’s see, I’m going to turn your microphone back on here for just a second, Pam. Pam, is there anything else you want to ask or add to this?

Pam: Yes. I was hoping that the body of the post would show the field summary. Now, every item does not have a summary but the ones that do, the summary is what actually describes the book. And I thought that…

Rick: Why don’t you give me an idea, a name…one with the summary in it?

Pam: Hang on a second. I have to check my…

Rick: Actually you know, I can find one here. I’ll just look in my thing here. Okay, so summary…so A Place of Healing.

Pam: Yes, that’s a good example.

Rick: Okay. So if we search for… okay, healing.Okay, A Place of Healing. If we hit edit here, there it is. The summary did end up inside this section here. And in fact, so did the subtitle right? The subtitle we have showed up down here as a custom field and that was one thing we haven’t done yet was set up the other bits of catalog information. I forgot about that. So we need to add that into here as well so I’m going to work on that. We’ll do that again tonight but… so does that work the way you thought it should?

Pam: Yes, that’s right. When you get farther down the road, you’ll want subtitles to appear at the top of that body of post because it will be formatted in a way that stands out a little more as a subtitle.

Rick: Yeah and so, it’s never… the subtitle will never be in this box here. We’ll just add the subtitle to the display. That’s the way it’ll work.

Pam: Okay, that’s great. Looks great.

0 Comments… add one

Save $200 on Membership Now!

Start learning today for as little as
$0.82 PER DAY!
Subscription Options
0 comments… add one

Leave a Comment