[SOLVED] Update datagridfield from plone.api or similar

I have about 75 items with datagridfield ( about 3 x 20 ) (which was supposed to be updated by 75 different persons).

Due to Covid, they sent me a Excel doc instead:

Is there a quick and dirty way of updating this, so I dont have to copy/paste 4500 times ?

(or does any have a script or an action)

Very 'quick and dirty', but probably saved me a day…

  1. In the view template of my content type, I added


  2. In my view.py , I added

    def print_styre(self):
        import pdb; pdb.set_trace()
  3. In my Excel file, I added rows and then copied to text editor and did search replace so I ended up with:

[{'function': 'Something', 'name': 'Something', 'email': 'something@else.no'}, {more lines},]

  1. Then when at debug in view I did

a) Print title to be sure I was at the right place (and that nobody else was visiting a similar page)


self.context.myfield = [{'function': 'Something', 'name': 'Something', 'email': 'something@else.no'}, etc ]

Repeat with next 'page'

Upload/maintain the excel with in Plone as File at a well-defined location, use an Excel parser for extracting the related value and populate the datagrid field with the related values from the parsed Excel sheet.

True, but since I doubt I need to do this again, I wanted a 'quick' fix, especially since it is a live site