I know that auto-completion sometimes helps you find unreferenced methods of Google objects such as for the Sheets API v4 but how can I find the attributes.
example with spreadsheets:
function onEdit(e)
{
Logger.log(e.range.columnStart)
//returns the start column of the range I've edited
Logger.log(SpreadsheetApp.getActiveSpreadsheet().getActiveSheet().getDataRange().columnStart)
//Weird result, even if my sheet is populated with values it returns 'undefined'
}
In this example you see the attribute columnStart
but I can't find it in documentation however a lot of people seems to use it.
Another point that can be out of subject but interesting, both e.range
and getDataRange
returns a Range
object but one seems to have a populated columnStart
attribute when the other don't.
e.range
from onEdit(e)
.If my understanding is correct, how about this answer? Unfortunately, the detail properties cannot seen at the document of Event Objects. So, for example, it confirms each properties from the event object using JSON.stringify()
.
function onEdit(e) {
Logger.log(JSON.stringify(e)) // or console.log(JSON.stringify(e))
}
{
"authMode": {},
"range": {
"columnStart": 1,
"rowStart": 1,
"rowEnd": 1,
"columnEnd": 1
},
"source": {},
"user": {
"nickname": "### name ###",
"email": "### email ###"
},
"value": "sample"
}
Logger.log(JSON.stringify(e.range))
is run, {"columnStart":1,"rowStart":1,"rowEnd":1,"columnEnd":1}
is retrieved. In this case, "A1" is edited.