I have one requirement about preparing excel and word document based on SharePoint list data and download it for user in SharePoint Online using SPFX web part.

My question is: Can we create SPFx web part in which it creates a document using code and download it from web part? OR even is it possible with SPFx web part to create a document using coding?


SPFx works using client-side JavaScript, meaning you can utilize any solutions out there that employ JavaScript.

For Word documents, you could use this tutorial explaining how to generate a Word document from some basic HTML, and download it using an a element.

For Excel documents, you could create a CSV file (a basic spreadsheet) using a similar method in this StackOverflow answer.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.