You could use the scripts I'm using as a starting point: https://opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=473310#Post473310

But I think, there is an easier way with the CSV to history script that comes with Zorro. You will find it in the scripts folder.