I'd like to pull values from a named range into a calculation. I have this function:
function getNamedRange(n){
SpreadsheetApp.getActiveSpreadsheet().getRangeByName(n);
}
Seems pretty simple. I have a named range called "budgetItems". It definitely exists and has about 6 values in it. But when I try to pull the values with
var items = getNamedRange("budgetItems"); items.getValues();
it usually says items is null. I've gotten it to work in the past but it seems really flaky. I suspect there is eventual consistency and caching goofing things up here.
I've attached this function (to pull the values from the range) to a menu item. When I run that menu item it takes about 15s to run 5 lines of js -- and then fails. That's... suspicious.
