diff --git a/templates/real-from-dwd-ana/prepare_experiment.sh b/templates/real-from-dwd-ana/prepare_experiment.sh
index 5d9b03dcf54d7cb2c3e32780033d78d6ca64d265..677cc057226382c8bf54c896be1ad0803906882f 100644
--- a/templates/real-from-dwd-ana/prepare_experiment.sh
+++ b/templates/real-from-dwd-ana/prepare_experiment.sh
@@ -8,8 +8,8 @@ EXTERNAL_PARAMETERS_FILE=%simulation.external_parameters_filename%
 
 
 # Activate spack
-SPACK_ENV=${WORKDIR}/spack/share/spack/setup-env.sh
-source ${SPACK_ENV}
+. ${WORKDIR}/proj/platforms/common/spack_utils.sh
+load_spack "%spack.init%" "%spack.root%" "%spack.url%" "%spack.branch%" "%spack.compiler%" "%spack.disable_local_config%" "%spack.user_cache_path%" "%spack.user_config_path%"
 
 # Load icon module needed to retrieve some data
 spack load icon-nwp@%ICON_VERSION%
diff --git a/templates/real-from-ideal/prepare_experiment.sh b/templates/real-from-ideal/prepare_experiment.sh
index b25b40a9fa6eeca08222eb7fb8e40f15c7bf2901..d7f3791f9b976ae250fce203c14f7986e9ea923a 100644
--- a/templates/real-from-ideal/prepare_experiment.sh
+++ b/templates/real-from-ideal/prepare_experiment.sh
@@ -6,8 +6,8 @@ DYNAMICS_GRID_FILENAME=%simulation.dynamics_grid_filename%
 RADIATION_GRID_FILE=%simulation.radiation_grid_filename%
 
 # Activate spack
-SPACK_ENV=${WORKDIR}/spack/share/spack/setup-env.sh
-source ${SPACK_ENV}
+. ${WORKDIR}/proj/platforms/common/spack_utils.sh
+load_spack "%spack.init%" "%spack.root%" "%spack.url%" "%spack.branch%" "%spack.compiler%" "%spack.disable_local_config%" "%spack.user_cache_path%" "%spack.user_config_path%"
 
 # Load icon module needed to retrieve some data
 spack load icon-nwp@%ICON_VERSION%