How to add data in docx file dynamically

I have a Word document (.docx) with a table and an API that retrieves user data in my nextjs app. How can I dynamically insert user data into the Word document?

Please clarify, are you using ONLYOFFICE Workspace? And you want to integrate it with your app and insert table data from it?