Are you looking at the latest version? The error can’t still be at line 3087.
Personally I would try to reduce the experiment to a single routine, with the outer spreadsheet containing the names of the inner spreadsheet (or row numbers) and the inner spreadsheet containing the animal details to customise the routine.