RAS Playground 日本語 GitHub

Getting started

Your first RAS project (command line)

To try RAS without installing anything, the quickest way is to open the playground in your browser. This page explains how to create a RAS project on the command line of your own computer and write a macro to an Excel workbook. For the steps using the VS Code UI, see Your first RAS project (VS Code).

Download

The prebuilt ras can be downloaded from Releases.

  1. Open the latest release
  2. From Assets, download the zip for your environment, and extract the zip
File Contents
ras-v0.1.0-windows-x64.zip ras.exe, ras_com.node, ras_book.node (Windows x64)
ras-v0.1.0-windows-arm64.zip ras.exe, ras_com.node, ras_book.node (Windows arm64)
ras-v0.1.0-linux-x64.zip ras and ras_book.node (Linux x64. For building, checking, offline writing, and debugging without Excel)
ras-v0.1.0-macos-arm64.zip ras and ras_book.node (macOS arm64. Same as above)

ras is a single binary with no runtime dependencies. Put it somewhere on your PATH. ras run and ras test convert the program to JavaScript and run it, so they need Node.js (node on the PATH; if there is none, the VS Code executable is used) and ras_book.node placed in the same folder as ras.

Create a project

ras init myproject --workbook Book.xlsm   # creates ras.toml, src/main.ras, and an empty macro-enabled workbook
cd myproject

This creates the following files (for the full structure, see Project structure).

myproject/
  ras.toml        Project settings (workbook location, etc.)
  src/main.ras    Standard module Main
  AGENTS.md       Guide for AI agents
  Book.xlsm       The workbook the macros are written to

For the "Normal" font of the empty workbook, Excel picks the one it uses for new workbooks according to this PC's display language (Yu Gothic 11 for Japanese, 맑은 고딕 for Korean, 等线 for Chinese (Simplified), 新細明體 12 for Chinese (Traditional), and Calibri 11 otherwise).

Write a macro

Write a function in src/main.ras. An exported function with no arguments becomes a macro you can run from Excel's Macro dialog.

// src/main.ras
/** Writes 1 to 10 and their squares in columns A and B of Sheet 1. */
export function squares() {
    for (let i = 1; i <= 10; i++) {
        Sheet1.cells(i, 1).value = i;
        Sheet1.cells(i, 2).value = i * i;
    }
    msgBox("Written");
}

Verify and run

ras check                      # type checking and lint
ras check --fix                # writes back to the source the warnings that can be fixed mechanically (such as names in VBA spelling)
ras run Main.squares           # runs without Excel and shows the changed cells

ras run runs on the Excel stand-in loaded with the workbook from ras.toml, and does not modify the original workbook (Run without Excel).

Write to the workbook

ras pack                       # writes directly into the VBA project of Book.xlsm without launching Excel

Open the workbook in Excel and run squares from Developer → Macros. ras pack does not write if the workbook is open in Excel (close it first). On Windows, you can apply changes to a workbook that stays open in Excel with ras sync. ras watch watches for changes and rebuilds, and also writes to the workbook when it is closed (Syncing with Excel).