Table-import manipulation

I installed the Table-Importer plugin, and got it to pull the data in correctly. I would love to use a 'if then" statement to condition the data I pull in from the csv file. Basically, I’m using the csv file as a simple database. If column1 = this text, then display column2. That is the basic usage that I want to do. This will enable me to build a large webpage quickly. I know I can enable twig in the front matter… however I’m not sure how to get twig to reference the csv file. Any help, or links to get me pointed in the right direction would be greatly appreciated. Twig syntax really resembles a lot of liquid syntax in Jekyll Static Site generator. I don’t know either language, but it is fairly easy to read and decipher.


The Table Importer plugin is too specific. It is designed only to build HTML tables from various input files. You need something more generic. I also have the basic Import plugin (GitHub is apparently having difficulties today, but the repo is there). But you’d still have to do a fair bit of work in Twig.

Also, see the plugins page and search for “data” or something like that for other database solutions.

Thanks for the tip. I actually was looking at modifying the php code on your plugin to have it use the conditional statement based on front matter in the page to determine what to display on the page… still thinking about that idea.


I installed the import plugin, because I think you may be right, that should work better. It will allow me the flexibility. I cannot get that plugin to import the document. I put the import: filename.yaml in the frontmatter of the page I want to import it to, and I get this error:

0 - Argument 1 passed to Symfony\Component\Yaml\Yaml::parse() must be of the type string, null given, called in /Users/username/Sites/gravtest/user/plugins/import/import.php on line 36

My frontmatter looks like this:

imports: ‘data:filename.yaml’

It did occur to me that perhaps this doesn’t belong in the front matter… but I’m not sure where to put it. Perhaps in the page template setup? Hopefully you can point me in the right direction on this. Thanks!


The docs will show you your error. It needs to be imports: 'user://data/filename.yaml'

1 Like

Thanks! The README file needs updated, as I was just grabbing the usage off of that. It says,

By default, the plugin looks for files in the same folder as the page itself. But you can prefix filenames with data: to anchor your search in the user/data folder.

And the Example it gives is:


  • ‘file1.yaml’
  • ‘data:file2.json’

At any rate, I got that fixed, and that indeed fixed the problem. Thanks! Now I can move on to bigger things, and work on pulling the data out I want.

Doh! Sorry about that! I must have copied that from some other plugin. I’ll fix that as soon as I can.

Not a problem. I’m struggling with usage too. I found this old post: Correct usage of Import plugin. When I try to implement the same usage… nothing shows on the page. I do have twig enabled. I will have to tinker with this later though.