title: Angular XLSX library, export an array of objects
body: <p>This is my mock data</p>
  
  <pre><code>mockData: any[] = [
    {
      "id": "456",
      "requestType": "Test",
      "requestDate": "10/15/20",
      "status": "Fail",
      "product": [
         {
           "productName": "product 1",
           "productQty": "12"
         },
         {
           "productName": "product 2",
           "productQty": "22"
         }
      ]
    }
  ]
  </code></pre>
  
  <p><strong>.ts:</strong></p>
  
  <pre><code>toExportFileName(excelFileName: string): string {
      var date = new Date();
      return `${excelFileName}_${date.getMonth() + 1}${date.getDate()}${date.getFullYear()}.xlsx`;
    }
  
    exportAsExcelFile(json: any[], excelFileName: string): void {
      const worksheet: XLSX.WorkSheet = XLSX.utils.json_to_sheet(json);
      const workbook: XLSX.WorkBook = { Sheets: { 'data': worksheet }, SheetNames: ['data'] };
      XLSX.writeFile(workbook, this.toExportFileName(excelFileName));
    }
  
    exportToExcel() {
      this.exportAsExcelFile(this.mockData, 'Shado_Test_Report');
    }
  </code></pre>
  
  <p><strong>Actual Results:</strong></p>
  
  <p><a href="https://i.stack.imgur.com/je7FR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/je7FR.png" alt="Actual Output"></a></p>
  
  <p><strong>Expected Results:</strong></p>
  
  <p><a href="https://i.stack.imgur.com/K7hzq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/K7hzq.png" alt="Expected Output"></a></p>
  
  <p>I'm trying to tweak the logic to handle the array of objects and specify the position in the xl, Can I achieve the above expected results based on the mockData with xlsx library ??</p>