curvegrid / multibaas-for-google-sheets

MIT License
8 stars 4 forks source link

Add functions to execute at a block number or at a timestamp #34

Closed shoenseiwaso closed 3 years ago

shoenseiwaso commented 3 years ago

Add custom functions to execute select functions at a given block or approximate timestamp:

Current Function New Function at a Block New Function at a Timestamp
MBADDRESS MBADDRESSATBLOCK(<block number>, ...) MBADDRESSATTIME(<Sheets timestamp>, ...)
MBGET MBGETATBLOCK(<block number>, ...) MBGETATTIME(<Sheets timestamp>, ...)

We could have just created a single MBADDRESSAT function, but there are corner cases which make it impossible to determine whether the first numerical parameter is a block or Sheets timestamp.

Note that spreadsheet dates are fundamentally represented as numbers as <days>.<fraction of a day>, regardless of how they're formatted. Using the Apps Script Date object should handle this automatically (example), but in case things get "weird", best to check with @shoenseiwaso before going too far down a rabbit hole.

Examples:

image