Help with Importing from CSV file

7 posts by 4 authors in: Forums > CMS Builder
Last Post: April 30, 2010   (RSS)

By zip222 - April 26, 2010

I have a fairly large list of classes that I need to enter for a new website. I was wondering if there is a way to import this information from an existing Excel or CSV file rather than entering it manually. While I am fairly experienced with CMS Builder and PHP, my knowledge of MySQL Databases is pretty limited.

thanks.

Re: [zip222] Help with Importing from CSV file

By ross - April 26, 2010

Hi there.

Thanks for posting!

There are definitely going to be options for importing your data from excel and CSV. If you like, it's something we can do for you through our consulting service but if you wanted to give it a shot yourself first, we go over it in this thread.

The first step here is going to be setting up your CMS Builder database. What you'll need to do here is go into CMS Builder and create a new section. Then, go through and create a field for every field in your import. The important part is to make sure the field names match up. So if you have a field in your CSV called, class_number, you'll need to create a field in CMS Builder called class_number as well.

Does that make sense? Let me know once you have that setup and we'll move onto the next step.

Thanks!
-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/

Re: [ross] Help with Importing from CSV file

By zip222 - April 27, 2010

There are some complexities in the details of this that I think are going to make this difficult to do through the forum. I am going to submit a priority consulting request instead.

thanks.

Re: [zip222] Help with Importing from CSV file

By Damon - April 27, 2010

Thanks!

I have your email now so we can discuss the requirements further via email/phone.
Cheers,
Damon Edis - interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Toledoh] Help with Importing from CSV file

By Damon - April 30, 2010

Hi Tim,

Importing data from a CSV file can be very tricky.

Some methods:
1. Manually add your CSV data into MySQL INSERT statements.

2. Parse the CSV file with custom programming.

Here are some tips for manually inserting data:
- backup your database
- open your database backup and you will see examples of INSERT statements
- create one insert statement and try it out
- use the free MySQL Console plugin to execute your MySQL queries:
http://www.interactivetools.com/add-ons/detail.php?MySQL-Console-1011

Here is an example INSERT:
INSERT INTO `#TABLE_PREFIX#_news` VALUES("1","2010-04-13 21:37:29","1","2010-04-13 21:37:29","1","1271194649","Hello World","2010-04-13 00:00:00","<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sodales viverra lacus, non ullamcorper mi posuere non. t</p>");
- replace #TABLE_PREFIX#_ with your actual mysql table prefix. You can find that in Admin > General Settings -
Database Settings

This is based on the following fields in a News section:
num
createdDate
createdByUserNum
updatedDate
updatedByUserNum
dragSortOrder
title
date
content

- num - needs to be unique
- *ByUserNum - needs to match a user number
- all the Dates need to be in the correct format. If you are not sorting by date, you can use a date from your backup.
- and there may be other requirements based on your fields and setup.

Give this a try by first testing with one or two INSERT statements after you have backed up your database.

As I mentioned, this is tricky and can be tedious.

Hope that helps a little.
Cheers,
Damon Edis - interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Damon] Help with Importing from CSV file

By Toledoh - April 30, 2010

Thanks Damon - I'll give it a try.
Cheers,

Tim (toledoh.com.au)