init script to download exctract csv
This commit is contained in:
parent
60e22cf78e
commit
3ec7259be6
1 changed files with 23 additions and 0 deletions
23
scriptDownload.js
Normal file
23
scriptDownload.js
Normal file
|
@ -0,0 +1,23 @@
|
|||
|
||||
var A = [['n','sqrt(n)']];
|
||||
|
||||
for(var j=1; j<5; ++j){
|
||||
A.push([j, Math.sqrt(j)]);
|
||||
}
|
||||
|
||||
var csvRows = [];
|
||||
|
||||
for(var i=0, l=A.length; i<l; ++i){
|
||||
csvRows.push(A[i].join(','));
|
||||
}
|
||||
|
||||
var csvString = csvRows.join("%0A");
|
||||
var a = document.createElement('a');
|
||||
var linktext = "Scarica la scheda e mettila al sicuro";
|
||||
a.href = 'data:attachment/csv,' + csvString;
|
||||
a.target = '_blank';
|
||||
a.download = 'schedaProduzione.csv';
|
||||
a.innerHTML = linktext;
|
||||
|
||||
document.body.appendChild(a);//mette un anchor per fartelo scaricare
|
||||
// a.click(); simula il click al caricamento della pagina
|
Loading…
Reference in a new issue