From 8c037f17f5f950b1344c215514caf6e53e786cc8 Mon Sep 17 00:00:00 2001 From: Adrien Joly <531781+adrienjoly@users.noreply.github.com> Date: Thu, 19 Mar 2020 11:46:43 +0100 Subject: [PATCH] feat: script to pass submissions file as an argument --- src/extract-student-submissions-from-spreadsheet-json.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/extract-student-submissions-from-spreadsheet-json.js b/src/extract-student-submissions-from-spreadsheet-json.js index a77489d..db661bd 100644 --- a/src/extract-student-submissions-from-spreadsheet-json.js +++ b/src/extract-student-submissions-from-spreadsheet-json.js @@ -1,9 +1,11 @@ // script to convert json file from google spreadsheet to /students/*.json submission files -const JSON_SUBMISSIONS_FILE = '../student-submissions.csv.json' // csv file exported from google spreadsheets and converted to json with https://www.csvjson.com/csv2json +// USAGE: $ node src/extract-student-submissions-from-spreadsheet-json.js ./student-submissions.csv.json + +const JSON_SUBMISSIONS_FILE = process.argv[2] || 'student-submissions.csv.json' // csv file exported from google spreadsheets and converted to json with https://www.csvjson.com/csv2json const fs = require('fs'); -const submissions = require(JSON_SUBMISSIONS_FILE); +const submissions = require('../' + JSON_SUBMISSIONS_FILE); try { fs.mkdirSync('./students');