For exporting you could use my script calcardbackup (I recommend with option -f|--fetch-from-database):
For importing to the new installation I would actually add a caldav Nextcloud-account to a client and then import the exported ics-file to the client and let the client sync the data to nextcloud. Importing directly to Nextcloud might lead to timeout issues due to the raspberry not being very fast. Depending on the size of the ics-file a direct import to Nextcloud might work without any problems though.
Good luck!