Any pivot tables in the template are carried over to XLSX output. The ranges in the pivot ranges are adjusted to match the generated output. So your final XLSX will be pivot tables set as expected in the generated file.
Any references (A1:D6) are adjusted inthe generated XLSX output to now be the new range based on the inserted data. This includes the case ofarange inside a forEach loop, where the range will be adjusted for each set in each iteration of the forEach.