0

I am using angularjs and javascript and want to export two arrays to Excel using alasql. The Excel file has two sheets, on every sheet there is one array.

In my Excel result I find an extra column $$hashkey. According to the information I found, using angularjs, the $$hashkey is automatically removed. I also tried adding 'alasql.options.angularjs' but it did not help. What am I doing wrong?

I am using the two arrays like this:

$scope.ExecutionsLC1: [[Execution,1,2,3],[Operators,1014,1019,1020],[Result,X,X,V]];
$scope.ExecutionsLC2: [[Execution,1,2,3],[Operators,2014,2019,2020],[Result,X,X,V]];

var opts = [{sheetid:'LC1',header:false},{sheetid:'LC2',header:false}];
var res = alasql('SELECT INTO XLSX("LCDetail.xlsx",?) FROM ?',[opts,[$scope.ExecutionsLC1,$scope.ExecutionsLC2]]);
m00am
  • 5,910
  • 11
  • 53
  • 69
S.vanNerum
  • 15
  • 1
  • 7

1 Answers1

1

it seems I can use angular.copy() to remove the $$hashkey.

var data1 = angular.copy($scope.ExecutionsLC1);
var data2 = angular.copy($scope.ExecutionsLC2);
var opts = [{sheetid:'One',header:false},{sheetid:'Two',header:false}];
var res = alasql('SELECT INTO XLSX("restest344b.xlsx",?) FROM ?',
                 [opts,[data1,data2]]);
S.vanNerum
  • 15
  • 1
  • 7