Skip to content

lfergon/meteor-export-csv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 

Repository files navigation

export-csv

Meteor export mongo collection to csv

Meteor methods server side

download: function() {
  var collection = CollectionToExtract.find().fetch();
  var heading = true; // Optional, defaults to true
  var delimiter = ";" // Optional, defaults to ",";
  return exportcsv.exportToCSV(collection, heading, delimiter);
}

JavaScript file, client side

//events
'click #buttonDownload': function(event) {
  var nameFile = 'fileDownloaded.csv';
  Meteor.call('download', function(err, fileContent) {
    if(fileContent){
      var blob = new Blob([fileContent], {type: "text/plain;charset=utf-8"});
      saveAs(blob, nameFile);
    }
  });

Known issues

  • Documents need to have an identical length of elements.
  • Objects are not displayed (export JSON instead).

About

Meteor export collection to csv

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •