The Spain Travel Health portal has individual forms you can fill out 48 hours before arrival where you'll get a QR code that you can download or print.