Hello
Thank you for your question and reaching out.
Please note that Installing Office on an RDS Server requires a Volume License or Microsoft 365 Apps for Enterprise installed using Shared Computer Activation mode.
Any other version of Office not only is a license violation, the installer may not even install it.
https://learn.microsoft.com/en-us/deployoffice/deploy-microsoft-365-apps-remote-desktop-services
--If the reply is helpful, please Upvote and Accept as answer--