I'm using Google Spreadsheets with Google Apps Script and I want to get the value of the edited cell which has a drop down list. I debugged using onEdit(e) and message box and e.range.value.
Browser.msgBox(`new value:${e.range.value},old value: ${e.range.old}`);
The result is
new value:undefined,old value: undefined
The value of the drop down cell was undefined even if the content is selected. Does that mean a cell with drop down list has no value even if the value can be seen in the formula box?
Maybe it is the specification of Data Validation or Criteria but I couldn't understand the reference of Google Apps Script. Is it possible to let the drop down list cell have the value which is written in the formula box?
Below is the full code of onEdit function:
function onEdit(e) {
Browser.msgBox("おんえでぃっとだ");
const sheet = e.source.getActiveSheet();
const row = e.range.getRow();//数字
const column = e.range.getColumn();//アルファベット
Browser.msgBox(`行列は取得した:(${row},${column})`);
const rule = e.range.getDataValidation();
const criteria = (rule == null) ? null:rule.getCriteriaType();
Browser.msgBox(`るーるとくらいてりあもいけた。るーる:${rule}くらいていりあ: ${criteria}`);
Browser.msgBox(`new value:${e.range.value},old value: ${e.range.old}`);
}


