score:1

There are several ways for doing that. Supposing data1 as the first parsed CSV (with id and grade but no status) and data2 as the second parsed CSV (with id and status), you can use find or filter to get the corresponding object in data2 and copying its status on data1.

For instance, using find:

data1.forEach(function(d) {
  var obj = data2.find(function(e) {
    return d.id === e.id
  });
  d.status = obj.status;
});

Here is a demo (using d3.csvParse, since the S.O. snippet doesn't allow real CSVs):

var csv1 = `id,grade
1,42
2,65
3,17`;

var csv2 = `id,status
2,yes
1,no
3,no`;

var data1 = d3.csvParse(csv1);
var data2 = d3.csvParse(csv2);

data1.forEach(function(d) {
  var obj = data2.find(function(e) {
    return d.id === e.id
  });
  d.status = obj.status;
});

console.log(data1)
<script src="https://d3js.org/d3.v5.min.js"></script>

I'm scrambling the rows in both CSVs just to show that the order doesn't matter, but only their id.

score:2

The easiest way to read and save files in JS is with Node.js. So this is working example written in Node.js and with data-forge:

const dataForge = require('data-forge');

/**
 * "csv1.csv":
 *
 * id, grade
 * 123, 1,
 * 345, 4,
 * 177, 5,
 */
const dataFrameGrades = dataForge.readFileSync('csv1.csv').parseCSV();

/**
 * csv2.csv:
 *
 * id, status
 * 123, 'yes',
 * 345, 'no',
 * 177, 'yes',
 */
const dataFrameStatuses = dataForge.readFileSync('csv2.csv').parseCSV();

/**
 * Merge columns from two CSV
 * 
 * dataFrame1 is left
 * dataFrame2 is right
 */
const dataFrameMerged = dataFrameGrades.join(
  dataFrameStatuses,
  grade => grade.id,
  status => status.id,
  (grade, status) => {
    return {
      id: grade.id,
      grade: grade.grade,
      status: status.status
    };
  }
);

/** Save CSV */
dataFrameMerged.asCSV().writeFileSync('csvMeged.csv');


Related Query