In case you have a tabular data, and you want to export the data as excel. Your best option in h5 is to export the data as csv file. CSV file can be easily imported into excel and by default is recognized by excel on windows.

Here's the function to export the data as a csv file download.

export function exportTableToExcel(table: string[][], filename: string = 'excel_data'){
  let text = => = '') => {
    if (s.indexOf(',') != -1) {
      return `"${s.replace(/"/g, '""')}"`;
    return s;

  let dataType = 'text/csv;charset=utf-8';

  // \ufeff is BOM for utf-8 encoding
  let blob = new Blob(['\ufeff' + text], {
    type: dataType,
  let url = URL.createObjectURL(blob);

  // Create download link element
  let downloadLink = document.createElement("a");
  // Create a link to the file
  downloadLink.href = url;

  // Setting the file name = filename + '.csv';

  //triggering the function;

call it like this

  ['Name', 'Email'],
  ['Sam', ''],
  ['Tom', ''],