title: How do I create an Excel File in S3 though nodejs?
body: <p>I'm trying to create a script that will take a JSON object and put it into the S3 bucket as an xlsx file</p>
  
  <p>I am planning on integrating SQL queries to the code but for now limiting it to JSON for easier coding. I've tried using alasql and xlsx to try and create the S3.putObject body but the output creates a corrupted excel file</p>
  
  <pre><code>var data = [{a:1,b:1,c:1},{a:1,b:2,c:1},{a:1,b:3,c:1}, {a:2,b:1,c:1}];
    var a = XLSX.utils.json_to_sheet(data);
  
    var params = {
    'Body' : Buffer.from(a),
    'Key': event.Key + '.xlsx',
    'Bucket': event.Bucket
  };
  
  s3.putObject(params).promise();
  </code></pre>
  
  <p>I expect that the data will be placed in an xlsx file in the S3 bucket and while the file is created, it is corrupted</p>