How do I download an excel/csv file dynamically generated on node js server?

Hello,

I have a requirement where in whenever a user clicks on download button on the screen I generate a csv file on the server and send it back via response.
Now I want to download/open this dynamically generated file on my ionic app.
How can I do this? I haven’t used cordova plugins so far so no ideas on that front.

Can someone please guide me on this?

I have a same issue. Could you resolve?

Anyone have suggestions for exporting excel files?

Hello,

Anyone found the solution for this. Suggests any idea. Thanks

The below might be helpful:

var targetPath = serverService.getDownloadLocation() + "attendance_" + todayStr +".xlsx";
				    var trustHosts = true
				    var options = {};

				    $cordovaFileTransfer.download(url, targetPath, options, trustHosts)
				      .then(function(result) {
				        console.log('File download successful');
				        $ionicLoading.hide();
				        deferred.resolve(result);
				      }, function(err) {
					        console.log('File download failed');
					        console.log(err);
					        $ionicLoading.hide();
					        deferred.reject();
					        throw err;
				      }, function (progress) {
					      	console.log('inside progress '+ progress.loaded);
					        //$timeout(function () {
					         // $scope.downloadProgress = (progress.loaded / progress.total) * 100;
					        //})
					     });

Simply inject the $cordovaFileTransfer plugin