-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathindex.html
33 lines (31 loc) · 1.01 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Angular Js XLSX</title>
</head>
<body ng-app="MyApp">
<div ng-controller="myController">
<js-xlsx onread="read" onerror="error"></js-xlsx>
</div>
<script type="text/javascript" src="bower_components/angular/angular.min.js"></script>
<script type="text/javascript" src="bower_components/js-xlsx/dist/xlsx.core.min.js"></script>
<script type="text/javascript" src="angular-js-xlsx.js"></script>
<script type="text/javascript">
angular.module('MyApp', ['angular-js-xlsx'])
.controller('myController', function($scope) {
$scope.read = function (workbook) {
/* DO SOMETHING WITH workbook HERE */
for (var sheetName in workbook.Sheets) {
var jsonData = XLSX.utils.sheet_to_json(workbook.Sheets[sheetName]);
console.log(jsonData);
}
}
$scope.error = function (e) {
/* DO SOMETHING WHEN ERROR IS THROWN */
console.log(e);
}
});
</script>
</body>
</html>