    Sub ExcelFromDataTable(tblData As DataTable, strFile As String, strSheet As String, strExt As String)
        'Creates a new workbook
        'SM Dec 2023
        Try
            Dim wkb As New XSSFWorkbook()
            Dim wks As XSSFSheet = wkb.CreateSheet(strSheet)
            Dim intRow As Integer = 0
            Dim objxRow As XSSFRow
            Dim objxCell As XSSFCell
            Dim strValue As String = ""
            Dim intCols As Integer = tblData.Columns.Count
            Dim intCol As Integer
            objxRow = wks.CreateRow(0)
            For intCol = 0 To intCols - 1
                strValue = tblData.Columns(intCol).ColumnName
                objxCell = objxRow.CreateCell(intCol)
                objxCell.SetCellValue(strValue)
                objxRow.Append(objxCell)
            Next
            For Each objRow As DataRow In tblData.Rows
                intRow += 1
                objxRow = wks.CreateRow(intRow)
                For intCol = 0 To intCols - 1
                    strValue = "" & objRow(intCol)
                    objxCell = objxRow.CreateCell(intCol)
                    objxCell.SetCellValue(strValue)
                    objxRow.Append(objxCell)
                Next
            Next
            With HttpContext.Current.Response
                .ContentType = "application/" & strExt
                .AddHeader("Content-Disposition", "attachment; filename=" & strFile & "." & strExt)
                wkb.Write(.OutputStream)
                .Flush()
                .Close()
                .End()
            End With
            wkb.Close()
            Console.WriteLine("File created.")
        Catch ex As Exception
            Console.WriteLine("Error:" & ex.Message)
        End Try
    End Sub