title: Uploading output of ExcelJS to Azure Blob Storage in NodeJS
body: <p>So I am using <a href="https://github.com/guyonroche/exceljs" rel="nofollow noreferrer">ExcelJS</a> to create an Excel file. Currently I am saving the file to disk. The data I am adding to the file is coming in from an API call.</p>
  
  <pre><code>let options = {
    filename: 'pathtofile',
    useStyles: true,
    useSharedStrings: true
  }
  
  let workbook = new Excel.stream.xlsx.WorkbookWriter(options)
  let sheet = workbook.addWorksheet('myWorksheet')
  
  // add some data to the file
  
  sheet.commit()
  workbook.commit()
  </code></pre>
  
  <p>I would like to now change it so it uploads to Azure Blob Storage. ExcelJS allows the specification of a <code>stream</code> instead of a <code>filename</code> in which to commit to. So I've decided to use <a href="https://github.com/paulja/memory-streams-js" rel="nofollow noreferrer">Memory Streams JS</a> so now the options look like this.</p>
  
  <pre><code>let stream = new streams.WritableStream()
  
  let options = {
    stream: stream,
    useStyles: true,
    useSharedStrings: true
  }
  </code></pre>
  
  <p>From reading the Azure documentation, the two most suitable methods seems to be <code>createBlockBlobFromStream()</code> and <code>createWriteStreamToBlockBlob()</code> and they both appear to want a Readable Stream (correct me if I'm wrong). This is where I'm stuck as I have a Writable Stream from using ExcelJS but I need a Readable Stream for Azure Blob Storage. Obviously I can still write the file to disk; create a Readable Stream from the file; and then finally delete the file after uploading to Azure Blob Storage but that is a lot of overhead. Am I going about this in a really roundabout way?</p>