Comments (2)
@pat310 Do we have any update on this? I need to provide data in excel (csv can also work) format.
from quick-pivot.
@daveRanjan @vijaysebastian : You can use this cool project https://github.com/exceljs/exceljs to make an Excel file.
Example in nodejs :
const ExcelJS = require('exceljs');
const Pivot = require('quick-pivot');
// Self-Executing Anonymous Functions
(async function(){
const wb = new ExcelJS.Workbook();
wb.creator = 'Example';
const sheet2 = wb.addWorksheet('Test',
{
views: [
{state: 'frozen', ySplit: 1}
],
properties:
{
tabColor:
{argb: 'FFC0000'}
}
}
);
// Load your data, make your pivot table
// For example
const dataArray = [
['name', 'gender', 'house', 'age'],
['Jon', 'm', 'Stark', 14],
['Arya', 'f', 'Stark', 10],
['Cersei', 'f', 'Baratheon', 38],
['Tywin', 'm', 'Lannister', 67],
['Tyrion', 'm', 'Lannister', 34],
['Joffrey', 'm', 'Baratheon', 18],
['Bran', 'm', 'Stark', 8],
['Jaime', 'm', 'Lannister', 32],
['Sansa', 'f', 'Stark', 12]
];
const rowsToPivot = ['name'];
const colsToPivot = ['house', 'gender'];
const aggregationDimension = 'age';
const aggregator = 'sum';
const pivot = new Pivot(dataArray, rowsToPivot, colsToPivot, aggregationDimension, aggregator);
pivot.data.table.forEach(line => {
// rowHeader in bold for example
switch(line.type) {
case 'rowHeader' :
sheet2.addRow(line.value).font = {
bold: true
}
break;
case 'aggregated':
sheet2.addRow(line.value).font = {
bold: true
}
break;
default:
sheet2.addRow(line.value)
}
})
await wb.xlsx.writeFile('your-physical-file.xlsx');
})();
from quick-pivot.
Related Issues (20)
- Filtering / Sorting
- Pivot should not add to collapsedRows if the row cannot be collapsed HOT 1
- Providing incorrect data types for rowsToPivot and/or colsToPivot throws filter error
- Filtering out all data throw error
- Filtering on value dimensions with string filter values instead of ints HOT 3
- 'Include' filtering with values that are a part of the unique values of that field throws error HOT 4
- Should pivot.getUniqueValues return unique values of the current pivot or original?
- Should filters stack / are they chainable? HOT 2
- Totals functionality HOT 2
- Grouping order changes upon filtering of sub-grouping HOT 1
- TypeError: Object.values is not a function HOT 4
- Filtering out all values returns empty array. Should return remaining unfiltered fields with 0 values.
- Support multiple aggregations HOT 2
- Support row totals HOT 1
- Row and column total header HOT 1
- Preserving order or column and row entries? HOT 3
- Support Multiple Aggregation Dimensions HOT 10
- Comparison functions used are causing unexpected results
- different behaviour between chrome and firefox with same dataset
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from quick-pivot.