module.exports = function (access_key, fromDate, callback) {

  const asana = require('asana')
  const csvWriter = require('csv-write-stream')
  const fs = require('fs')

  // Using the API key for basic authentication. This is reasonable to get
  // started with, but Oauth is more secure and provides more features.
  let client = asana.Client.create()
    .useBasicAuth(access_key)


  client.users.me()
    .then(function (user) {
      let userId = user.id
      console.log(`\n--- Getting Asana info:\nUser ID: ${userId}`)
        // The user's "default" workspace is the first one in the list, though
        // any user can have multiple workspaces so you can't always assume this
        // is the one you want to work with.
      let workspaceId = user.workspaces[0].id
      console.log(`Workspace ID: ${workspaceId}`)

      return client.tasks.findAll({
        assignee: userId,
        workspace: workspaceId,
        completed_since: fromDate,
        opt_fields: 'id,name,projects,completed,completed_at,due_at,due_on,notes'
      })
    })
    .then(function (response) {
      console.log('Data gotten, formatting..');
      return response.data.map( el => {  // Extract only response's data and correctly format 'project' property
        el.project_id = el.projects[0]?el.projects[0].id.toString():"" // As far as we know a task is only associated with one project
        delete el.projects
        return el
      });
    })
    .filter(function (task) {
      return task.completed_at !== '' && task.completed_at !== null
    })
    .then(function (list) {
      //Write entries to CSV File
      let writer = csvWriter()
      writer.pipe(fs.createWriteStream('Monthly Report.csv'))
      for (let task of list) {
        writer.write(task)
      }
      writer.end()
      console.log('Data written to "Monthly Report.csv" file in root of project :)\n');
      callback()
    })
}

@@ -1034,17 +1034,36 @@
 n,notes'
+,%0A        limit:100
 %0A
-
       %7D)
@@ -1098,24 +1098,93 @@
 response) %7B%0A
+      response.fetch().then(restPages =%3E %7B%0A      let filteredTasks%0A  
       consol
@@ -1225,22 +1225,33 @@
 ;%0A      
-return
+  filteredTasks =
  respons
@@ -1343,16 +1343,18 @@
 roperty%0A
+  
         
@@ -1488,16 +1488,18 @@
         
+ 
+ 
 delete e
@@ -1513,24 +1513,26 @@
 cts%0A        
+  
 return el%0A  
@@ -1539,14 +1539,8 @@
     
-%7D);%0A  
   %7D)
@@ -1544,16 +1544,75 @@
  %7D)%0A    
+    filteredTasks.push(response.data)%0A        filteredTasks
 .filter(
@@ -1631,24 +1631,28 @@
 sk) %7B%0A      
+    
 return task.
@@ -1705,43 +1705,24 @@
 ull%0A
+    
     %7D)%0A
+%0A
     
-.then(function (list) %7B%0A
     
@@ -1753,24 +1753,28 @@
  File%0A      
+    
 let writer =
@@ -1788,24 +1788,28 @@
 ter()%0A      
+ 
+   
 writer.pipe(
@@ -1852,16 +1852,20 @@
 .csv'))%0A
+    
       fo
@@ -1879,20 +1879,29 @@
 task of 
-list
+filteredTasks
 ) %7B%0A    
@@ -1900,24 +1900,28 @@
 ) %7B%0A        
+  
+  
 writer.write
@@ -1937,16 +1937,20 @@
     
+    
 %7D%0A      
 writ
@@ -1941,24 +1941,28 @@
     %7D%0A      
+ 
+   
 writer.end()
@@ -1962,16 +1962,20 @@
 r.end()%0A
+    
       co
@@ -2060,16 +2060,20 @@
 ;%0A      
+    
 callback
@@ -2075,17 +2075,33 @@
 lback()%0A
+%0A%0A      %7D)%0A%0A
     %7D)%0A
+    
 %7D%0A

Use fetch to load all the tasks.