/**
* write 2D data into sheet.
* @example
* sheet.__proto__ = app.sheetPrototype
* sheet.setValues(data)
*/
app.sheetPrototype = {
// ๐ธ sheet.setValues(data)
setValues(data, row=1, col=1){
if(!data || data.length === 0 || !data[0] || data[0].length === 0)
throw new Error(`โ๏ธ app.sheetPrototype.setValues(): data ๆฏ็ฉบ็๏ผ็กๆณๅฏซๅ
ฅ่ฉฆ็ฎ่กจโ๏ธ`);
// ่ณๆ่กจ็ใๅๆธใ่ใๆฌๆธใ
let rows = data.length;
let cols = data[0].length;
// ๅฏซๅ
ฅ้ ้ข
this
.getRange(row, col, rows, cols)
.setValues(data);
return this; // for chaining
},
};