Search

Wondering how simple it would be to import an excel document into a Symphony database, I think it would basically end up being a simple list of someone’s name, email, and a photo into one section.

How would you guys tackle a problem like that? Would you use phpMyAdmin or something like Sequel Pro?

As a designer, I’m comfortable poking my way around a database in phpMyAdmin and editing values if need be. But I’ve never done any queries.

I wouldn’t play around with Symphony’s database. It’s its only downside… the normalization level is too high for anyone to understand it :-)

I would suggest writing your own event and firing it for every line. You either feed it with the values in the POST fields yourself or letting the event decompose your CSV data.

Or… maybe an event can fire trigger() several times. In this case you can decompose the whole dataset in the event and create an entry for each line.

To any of you experts: can an event do that?

You should be able to use a similar method to my Archiving XML with Symphony article. But instead of taking data from an XML feed, you would parse a CSV.

So start by exporting the spreadsheet from Excel as a comma-delimited file (CSV).

  • create your section and fields
  • create an Event tied to this section, select the Allow Multiple in the list when creating the event
  • create a new blank Page and attach the event to it

Then take a look at my article. I presume you’re doing a one-time import, so this script doesn’t need be repeatable. In which case you can discard some of what I wrote about. Essentially you want a PHP script which opens your .csv file, iterates over each row, builds an array of rows to send to Symphony, then sends them to the event.

ooh now this sounds interesting.. again like Jester12 says.. as a designer poking around a bit is god fun :) Sounds like what I am looking for Nick.. Would it be able to parse and create multiple entries? As in.. Import multiple entries into a section from csv? Your description leans towards one entry.

The article above does multiple entries, hence the comment about ticking “Allow Multiple” in the event.

I just don’t read these days do I!! oops

Thanks again Nick, you’re always super helpful. It looks like you gave me all the elements to make it happen, I may end up posting again as I try to combine them all together. I hope to be able to try this out at work, but they may head in a different direction.

How would it be possible from a csv to import an image/photo as jester says in the first post? is it a case of uploading the images to a designated folder and then the csv ties the upload path to the image?

@TheJester12 did you manage to get a php script working with this?

Got as far as getting a page with the event attached but Nicks script looked too complicated for little brain!

Sorry, I did not end up going this route. I ended up having people in my company fill in the information into Symphony, and then exporting it as a csv instead.

Ye that’s what I have!

Was just looking at a way to populate a section from a csv if need be in the future.. i.e build a new site with Symphony 2.1 (when it becomes available) and pull entries from previous version over to the new install using a csv import technique. I’ll keep looking, cheers.

Nick Dunn,

would I be able parse/import the csv data through my front end form? It has form-controls utility on each value.

Was thinking if it was possible this way instead of the php from the Archiving xml tutorial.. Not looking for an easy way out here.. just which method would be better suited for the client to use in the long run really. And if that means re-using the front end contact form to perform the task then great! As long as the input method could be a .csv

Perhaps Excel can output as XML. Or you could write a PHP script to convert a CSV file into XML. You could then include the XML file in one of your XSLT pages (using the document() function), iterate over the XML as usual (with an xsl:for-each perhaps) and build your form inputs this way.

Similar to Stephen’s Importing Entries from WordPress tutorial.

Open Office does csv to XML but it’s M$ version with lots of gobbledeegook included in the file.. hmmm wonder if there’s a clean up method. Starting to go off topic here… so I’ll stop.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details