Created
October 14, 2021 04:58
-
-
Save neno-tech/394f431970dd17d9bf5229701a3c4aa5 to your computer and use it in GitHub Desktop.
โค้ดแปลง Google Form เพื่อวิเคราะห์ข้อสอบ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function analize() { | |
var ss = SpreadsheetApp.openById('xxx').getSheets()[0]//ใส่ไอดีชีตแทน xxx | |
var data = ss.getRange('E2:X69').getValues()//ใส่ช่วงข้อมูลของท่านให้ถูกต้อง | |
var indexObj ={ ก: "1", ข: "2", ค: "3", ง: "4" } | |
data = data.map((row,i)=>{ | |
row = row.map(col=>{ | |
col = col.split(".")[0] | |
return indexObj[col] | |
}) | |
return [("00"+(i+1)).slice(-4)+" "+row.join("")] | |
}) | |
var newsheet = SpreadsheetApp.openById('xxx').getSheets()[1]//ใส่ไอดีชีตแทน xxx | |
newsheet.getRange(newsheet.getLastRow()+1,1,data.length,data[0].length).setValues(data) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment