The UK Government Advice for travelling through France has been updated as below:-

Travel via France

If you are planning on travelling through France to return to the UK, the French government have implemented their own measures, including required documents for travel into, and transit through, France.

If you’re planning to travel via France, check the latest FCO travel advice for France ahead of your journey.

While you are not required to carry any paperwork to justify your travel in Spain other than evidence of your onward travel plan (i.e. rail ticket), you may find the letter below (print or save to your mobile) useful to explain that you are returning to your country of residence.