Feels native to Sheets
Call EVAL_RUBY_SCRIPT() like any other custom function and reference spreadsheet cells directly.
Google Sheets · Ruby · WebAssembly
sheetruby brings Ruby to Google Sheets as a custom function. Write Ruby in a formula, pass in cells or ranges, and get the result back in your spreadsheet.
sheetruby embeds mruby/edge into Google Apps Script as WebAssembly. No separate application server is needed: formulas are compiled and evaluated in the Apps Script environment.
Call EVAL_RUBY_SCRIPT() like any other custom function and reference spreadsheet cells directly.
Use Ruby syntax and the bundled Math module for calculations, transformations, and text handling.
Numbers, strings, booleans, and 2D cell-range arrays move between Sheets and Ruby through JSON serialization.
The source text and spreadsheet values stay together through a compact Rust and WebAssembly pipeline.
The custom function receives Ruby source plus as many as three cell or range arguments.
The embedded compiler produces mruby bytecode, then the Rust-based VM executes it inside Wasm.
The Ruby result is serialized as JSON and converted back into a value Google Sheets understands.
Get started
EVAL_RUBY_SCRIPT() in a cell.# Evaluate Ruby directly
=EVAL_RUBY_SCRIPT("1 + 2")
→ 3
# Pass a cell as $arg1
=EVAL_RUBY_SCRIPT("$arg1 * 2", A1)
→ 42
# Ruby string methods
=EVAL_RUBY_SCRIPT("$arg1.upcase", A1)
→ "HELLO"
# Bundled Math support
=EVAL_RUBY_SCRIPT("Math.sqrt($arg1)", 16)
→ 4.0
EVAL_RUBY_SCRIPT(code, arg1, arg2, arg3)
Multiple cells arrive in Ruby as a two-dimensional array.
Up to three values or ranges are exposed as $arg1–$arg3.
Open source · MIT licensed
Explore the source, report an issue, or help shape the next version of sheetruby.