I want to export json data in xls format in meteor app.

I am able to download json data in csv format in meteor app. But I can’t download in xls format. I want to export json data in xls format in Meteor application.

Hi @zehra ,
As I pointed out on GitHub we need a bit more information in order to assist you. What exactly are you doing currently to get cvs data. What kind of data are you retrieving.
For vague definitions like this I can only answer vaguely like that you should use a package like xlsx to convert your data into the desired format:

1 Like

Hi, I’m using the harrison:papa-parse package and I want to download it in xls format. It is downloaded in cvs format.

I have answered you above. Thank you very much for trying to help.

I’ve been using exceljs - npm in shared code for a while now. It’s very robust

Another option would be to use xlsx package:

They even have a Meteor demo ready:

1 Like

Can you send me the sample github code?

Can you send me the sample github code?

I couldn’t get this to work.

They have an example here:

If it works or not depends on your implementation and if it fits your use case. I’m just providing you options. Feel free to try exceljs that @sarojmoh1 mentioned.

I couldn’t get this to work.

If I share my codes with you, do you mind if you look at the drive that way?

You can check out some code that someone replied to on a question I had.

I’m using the client-side version of ExcelJS in my app though, so that user can download spreadsheet from browser.

Are you trying to do this on Server/Client?

Fwiw, looks like PapaParse probably won’t support exporting as .xls. It is a great package though! Do you really need .xls though? .csv opens up fine in Excel too. Users can open in excel and save as .xls

I want to do this using meteorjs using templates. This example was not helpful.

Definitely requested in xls or xlsx format, I tried another package. I couldn’t do it there. I am sharing the codes below.

İt is my server.js

if (Meteor.isServer) {
downloadExcelFile: function() {
var Future = Npm.require(‘fibers/future’);
var futureResponse = new Future();
var excel = new Excel(‘xlsx’); // Create an excel object for the file you want (xlsx or xls)
var workbook = excel.createWorkbook(); // Create a workbook (equivalent of an excel file)
var worksheet = excel.createWorksheet(); // Create a worksheet to be added to the workbook
worksheet.writeToCell(0,0, ‘Apontamentos’);
worksheet.mergeCells(0,0,0,1); // Example : merging files
worksheet.writeToCell(1,0, ‘Nome’);
worksheet.writeToCell(1,1, ‘Produção’);
var row = 2;
Hastakayit.find().forEach(function(a) {
worksheet.writeToCell(row, 0, a.safrista_id);
worksheet.writeToCell(row, 1, a.production);
workbook.addSheet(“Apontamentos”, worksheet);

		mkdirp('tmp', Meteor.bindEnvironment(function (err) {
				if (err) {
						console.log('Error creating tmp dir', err);
				else {
						var uuid = UUID.v4();
						var filePath = './tmp/' + uuid;

						temporaryFiles.importFile(filePath, {
								filename : uuid,
								contentType: 'application/octet-stream'
						}, function(err, file) {
								if (err) {
								else {
										futureResponse.return('/gridfs/temporaryFiles/' + file._id);

		return futureResponse.wait();


it is my bilgiler.js

This is the command system when you click the button.

In Excel, it says that the file downloaded in this way is incorrect and corrupt.