Costas Kounadis
Costas Kounadis

Reputation: 21

Create excel pivot with javascript

I am using below code to create an excel pivot in javascript

var xcl = new ActiveXObject("Excel.Application");
iUi = xcl.LanguageSettings.LanguageID(2);
xcl.Visible = true;
var newBook = xcl.Workbooks.Add();
var wsSheet = newBook.Worksheets.Add();
var rnStart = wsSheet.Range("A1");
wsSheet.Name = "Results";
var ptCache = newBook.PivotCaches.Add(2, "");

but get wrong message for PivotCaches.Add. Any suggestions ? Thanks !

Upvotes: 0

Views: 595

Answers (1)

Costas Kounadis
Costas Kounadis

Reputation: 21

The problem is that row var ptCache = newBook.PivotCaches().Add(2, "");

Now works fine !

Upvotes: 1

Related Questions