Skip to main content

sheets

Sheet is a notepad-style calculator that computes answers as you type. It has full access to your transactions, making it easy to solve a wide range of financial questions.

Let’s start with a simple example: calculating the monthly EMI for a home loan. The sheet below is live, you can modify the price or other inputs, and the monthly_payment will update in real time.

Syntax

Number

Commas are supported as separators for improved readability. The % symbol is interpreted as a shortcut for dividing by 100. For example, 8% is treated as 0.08.

Operators

The following arithmetic operators are supported. The ^ symbol represents exponentiation.

Variables

Variables can be defined using the = operator. Each variable must be assigned a value before it is used in a calculation.

Comments

Single-line comments are supported and can start with ; or //.

Functions

Built-in functions are available, and you can define your own as well. A function begins with its name, followed by a list of arguments, and its body consists of a single expression.

Query

Query is what makes Sheet especially powerful, enabling you to perform calculations on your transactions.

In a real scenario, queries run on your own transaction list, but for this documentation, the transactions shown here will be used instead.

Aug 19, 25InvestmentSBI Bank5000UTI Nifty 50 Index Fund28.6828@174.32Aug 8, 25Pay Credit Card BillSBI Bank31830CreditCard31830Aug 8, 25EMISBI Bank30000Homeloan21267Homeloan Interest8733Aug 7, 25GroceriesCreditCard4800Food4800Aug 6, 25Eat outCreditCard2400Restaurants2400Aug 5, 25ShoppingCreditCard2800Shopping2800Aug 4, 25MobileCreditCard430Utilities430Aug 3, 25InternetCreditCard1500Utilities1500Aug 2, 25RentCreditCard19900Rent19900Aug 1, 25InvestmentSBI Bank85000UTI Nifty 50 Index Fund350.44@171.2116ABSL Corporate Bond Fund215.63@115.9447Aug 1, 25SalarySalary213075Tax30450SBI Bank152175EPF30450

Before we dive into writing queries, it’s important to understand postings.

Every transaction is made up of two or more postings. Each posting affects an account, and the overall sum of all postings in a transaction is always zero. A posting is considered negative (-) if it appears on the left side and positive (+) if it appears on the right.

Let’s look at the EMI transaction from August 8, 2025. It has three postings:

AccountAmount
SBI Bank-30,000
Homeloan21,267
Homeloan Interest8,733
Total0

Queries operate at the posting level, not the transaction level. This means each individual posting is evaluated separately.

For example, if you want to calculate the total amount spent on Utilities in August 2025, you can use the built-in cost function, which sums the amounts of all matching postings:

A query is enclosed in {} and uses the format: property operator value

Let’s break that down:

  • Property: The field to match on. Supported properties:

    • account – the posting account name
    • category – the account's category (e.g. asset, expense)
    • amount – the posting amount
    • description – the transaction description
    • date – the transaction date
  • Operator:

    • = – equals
    • =~ – matches regular expression
    • <, <=, >, >= – numerical comparisons
  • Value: Depends on the property. It can be:

    • A string (for account or description)
    • A number (for amount)
    • A date
    • A regular expression

You can use queries with built-in functions like cost, which adds up the amounts of all postings that match the given query.

Here are a few examples:

Queries are values too. You can assign them to variables, combine them with AND / OR, or negate them with NOT. This helps make queries more readable and reusable.

Date

Dates are treated as ranges with a start and end. For example:

  • [2023-01-01] represents a single day
  • [2023-01] covers the entire month of January 2023
  • [2023] includes the full year

Natural language shortcuts are also supported. You can use expressions like:

  • [last month]
  • [this month]
  • [last year]
  • [lastweek]
  • [jan 2023]

These make it easier to filter by common date ranges without specifying exact dates.

Regular Expression

Regular expressions are supported wherever string values are used. Use the =~ operator followed by the pattern. For example, to calculate the total cost of mobile-related bills under the Utilities account:

This adds up all postings where the description contains "mobile" (case-insensitive) and the account is Utilities.

Built-in Functions

cost(query)

Returns the total amount across all postings that match the query.

balance(query, asOn?)

Computes the current balance for the given query. By default, it uses the latest market prices. You can pass a date to pin the price lookup to a specific day. Only the price data is affected, not the set of postings used in the calculation.

fifo(query)

Returns the list of postings after applying FIFO (First In, First Out) cost basis logic.

log(x)

Computes the natural logarithm of a number.

realizedProfitAndLoss(query)

Computes the realized profit and loss for the given query.

unrealizedProfitAndLoss(query, asOn?)

Computes the unrealized profit and loss for the given query. By default, it uses the latest market prices. You can pass a date to pin the price lookup to a specific day.