title: How to download data as Excel (.xslx) in Nextjs
body: <p>I want to add a &quot;Download as Excel&quot; button to my Nextj application, by using any library to simplify the development or adding a component to my project; I already tried these but had issues with both of them:</p>
  <blockquote>
  <ol>
  <li><a href="https://www.npmjs.com/package/react-html-table-to-excel" rel="nofollow noreferrer">https://www.npmjs.com/package/react-html-table-to-excel</a></li>
  </ol>
  </blockquote>
  <p>This Downloads data with '.xls' file extension so opening them with excel throws a warning. I tried to edit the source code and change file extension to '.xlsx' but this makes the output file corrupted.</p>
  <p><a href="https://i.stack.imgur.com/ExCYR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ExCYR.png" alt="enter image description here" /></a></p>
  <blockquote>
  <ol start="2">
  <li><a href="https://www.npmjs.com/package/react-export-excel" rel="nofollow noreferrer">https://www.npmjs.com/package/react-export-excel</a></li>
  </ol>
  </blockquote>
  <p>this works fine with react-create-app but can't make it work in Nextjs due to it's custom webpack configuration. I can't make this part working in Nextjs</p>
  <pre><code>///webpack.config.js
  vendor: [
          .....
          'xlsx',
          'file-saver'
  ],
  .....
  node: {fs: 'empty'},
  externals: [
      {'./cptable': 'var cptable'},
      {'./jszip': 'jszip'}
   ]
  </code></pre>
  <p>Thanks in advance for any guide!</p>