I am trying to export a HTML table into an excel sheet and I am using alasql:
$scope.Excelexport =function(){
alasql('SELECT * INTO XLSX("example.xlsx",{headers:true}) FROM ?',[$scope.college.data]);
}
This doesn't work for me because my data looks like:
$scope.college.data = [
{{[{faculty: 20k, Student:5k}], name:MIT}},
{{[{faculty: 20k, Student:5k}], name:Stevens}},
{{[{faculty: 20k, Student:5k}], name:RIT}},
{{[{faculty: 20k, Student:5k}], name:IIT}},
]
When I use the export I get [object,object]
as a result. I know the reason is that because my array is of objects of objects. How do I get the some[]
to show up in the excel with the name as heading?
In Excel, I want the data to look like
Faculty | Student
----------------------
MIT
----------------------
20k | 500k