This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// API access key from Google API's Console | |
define( 'API_ACCESS_KEY', 'YOUR-API-ACCESS-KEY-GOES-HERE' ); | |
$registrationIds = array( $_GET['id'] ); | |
// prep the bundle | |
$msg = array |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div> | |
<button class="centre btn mc" (click)="downloadExcel()">Download</button> | |
</div> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Workbook } from 'exceljs'; | |
import * as fs from 'file-saver'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
json_data=[{ | |
"name": "Raja", | |
"age": 20 | |
}, | |
{ | |
"name": "Mano", | |
"age": 40 | |
}, | |
{ | |
"name": "Tom", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
json_data=[{ | |
"name": "Raja", | |
"age": 20 | |
}, | |
{ | |
"name": "Mano", | |
"age": 40 | |
}, | |
{ | |
"name": "Tom", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//create new excel work book | |
let workbook = new Workbook(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//add name to sheet | |
let worksheet = workbook.addWorksheet("Employee Data"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//add column name | |
let header=["Name","Age"] | |
let headerRow = worksheet.addRow(header); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for (let x1 of this.json_data) | |
{ | |
let x2=Object.keys(x1); | |
let temp=[] | |
for(let y of x2) | |
{ | |
temp.push(x1[y]) | |
} | |
worksheet.addRow(temp) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//set downloadable file name | |
let fname="Emp Data Sep 2020" | |
//add data and file name and download | |
workbook.xlsx.writeBuffer().then((data) => { | |
let blob = new Blob([data], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' }); | |
fs.saveAs(blob, fname+'-'+new Date().valueOf()+'.xlsx'); | |
}); |
OlderNewer