I would like to import csv files into Dexterity content on Plone 5. I've been following the instructions under "transmogrify.dexterity.csvimport" in the documentation for transmogrify.dexterity, but I always end up with a page that tells me "Nothing to Import" after I upload the tarball and import it.
I'm not sure whether I'm missing some steps before uploading the tarball, or if something is wrong with my tarball. I've added collective.transmogrifier, transmogrify.dexterity, and plone.app.transmogrifier to eggs and zcml in the buildout file before trying to upload the tarball. Might anyone have an example tarball that works and that I could try using?
I am trying to upload a csv file to my Plone instance, with each row being a new dexterity content type. When I upload the csv file, I want it to create as many "Documents" as I have rows in my csv file and for the data to appear in the "Content" tab on my boilerplate Plone page. I tried to use the documentation on transmogrifier.dexterity.csvimport which is here: transmogrify.dexterity, but that was unsuccessful so I have been unsuccessfully trying to find other ways to do this. Please let me know if I can provide any other relevant information
Thank you for the response and for linking to the documentation. I have a specific question about the documentation. In the screenshot below, I don't see where the function registerConfig is defined and where to put the xml/html-looking code. The >>> suggests that we should be entering these commands into the plone instance interactive mode. But it's not clear to me where <configure ...> and <transmogrifier ...> go.
Thanks @hvelarde for your responses. It seems like what @peterg17 and I are trying to accomplish (upload a csv file into Plone with each row being a dexterity content item) has been done before, as this blog post explains how to do it. I've actually tried following the instructions in that blog post using a Plone 4 instance instead of Plone 5, but again it resulted in a page saying "Nothing to import." I will look into the Transmogrifier documentation as well, but if there is a way to use transmogrify.dexterity.csvimport instead of starting from scratch, that would be great.
You can use https://github.com/collective/collective.importexport. It works on plone 5 with dexterity. It will create or update new content. It doesn't handle file data however, but could handle html... I'm not sure. We haven't made a release of it yet but let us know if it breaks
As @hvelarde says you need to have a configure.zcml to enter this into.
Best way to do this is to create a new package under src using mrbob (look up bobtemplates.plone). Then you can add the transmogrifier:registerConfig statement... and the xmlns:transmogrifier line too.
Your package will need to depend on transmogrify.dexterity, collective.transmogrifier & maybe other transmogrifier packages too.
Then you want to make example.cfg a copy of csvimport.cfg in transmogrify.dexterity, and adapt it to your needs.
Adapting it probably only means changing this line
I think that's a good start, but I've not tried this exactly. So give it a go and feed back here.
Hope that helps
@dianezhou96 I think this should help you too. The main issue with the transmogrify.dexterity example is that importcontext in the above line is just a placeholder for a package name. But if you do things how I've worked out, then you should be able to avoid the tarball stuff mentioned in transmogrify.dexterity docs
Thank you for your answer! I went through all of the steps you recommended but i'm not sure how to use the package once it's there. Like what commands do I run that actually puts my file called "entries.csv" into dexterity content? How will I know that it worked?
(you can ignore the rest as you are not needing collective.jsonify)
Both these methods give you a view on the Plone site where you can select the pipeline you have created (example.cfg or "Example pipeline configuration") from a dropdown menu, and run it. If it's not in the dropdown menu, then somehting went wrong in the earlier steps.
You should take a look at plone.restapi You can write a simple Python script converting your CSV to JSON and POST it to your instance. It is a very simple and clean approach we made very good experience with.