# Profit and Loss Report

This guide walks through how to fetch data from a Bkper book and use Google Sheets to produce a Profit & Loss statement. Beyond the P&L itself, it explains how each piece connects so you can build your own reports.

![A Profit and Loss report on Google Sheets built with data from a Bkper book](https://bkper.com/docs/_astro/bkper-p-l-on-google-sheets.C6vS88cl.png)

## The key parts

A **Bkper book** is a ledger that tracks transactions between accounts. Each posted transaction updates the balance values of both accounts, keeping balances consistent over time.

The **chart of accounts** on a Bkper book organizes accounts into categories that can resemble a Balance Sheet and an Income Statement, or be structured around more managerial categories.

The **Bkper Add-on for Google Sheets** integrates Bkper with Google Sheets, enabling you to fetch financial data from a book directly into a spreadsheet.

![Diagram showing data flow from a Bkper book to a Google Sheets report via the Bkper Add-on](https://bkper.com/docs/_astro/financial-statements-flow._53cQn-y.png)

A **Bkper Function** is inserted into the Google Sheet by the Add-on to maintain a live connection to your book. From that point on, each newly posted transaction automatically updates your P&L report.

## Working example

To follow along, use these samples (you can make your own copies to experiment):

- [Bkper Sample Book](https://app.bkper.com/b/#transactions:bookId=agtzfmJrcGVyLWhyZHITCxIGTGVkZ2VyGICAwMWc48ELDA)
- [P&L Report on Google Sheets](https://docs.google.com/spreadsheets/d/1_jQHHnoHFjJ4JnuEkJ-zenMLvQSAjiFD8hLZ6TeN6ZI/edit#gid=168077234)

## Chart of accounts

A well-organized chart of accounts is essential to a P&L report — its structure should reflect the data you want to present.

Bkper's group hierarchy lets you organize accounts to mirror accounting definitions. For example, **Gross Margin** = **Revenue** - **Cost of Goods Sold**.

This hierarchy continues: **Income** = Gross Margin - Expenses, and further, **Net Income** = Income + Non-operational income.

**Learn more:** [Groups](https://bkper.com/docs/core-concepts.md#groups)

## The Bkper Add-on for Google Sheets

The Bkper Add-on sidebar opens within Google Sheets, where a form on the **Fetch** tab helps you define the scope of data to retrieve.

![Bkper Add-on sidebar in Google Sheets showing the fetch form configured for the Net Income group](https://bkper.com/docs/_astro/bkper-addon-sidebar.Ybb3EJq6.png)

In this example, the query field is set to the **Net Income** group for the year **2024**. Pressing the **Fetch** button inserts a Bkper Function into the sheet that retrieves the corresponding data:

```
=BKPER_BALANCES_TOTAL("agtzfmJrcGVyLWhyZHITCxIGTGVkZ2VyGICAwMWc48ELDA", 1, "group:'Net Income' on:2024", 2, FALSE, FALSE)
```

![Google Sheets showing the result of the Bkper Function fetching Net Income data](https://bkper.com/docs/_astro/bkper-addon-result.B4SVBlm_.png)

**Learn more:** [Bkper Add-on for Google Sheets](https://bkper.com/docs/guides/google-sheets.md) | [Build Your First Report](https://bkper.com/docs/guides/google-sheets/first-report.md) | [Bkper Query Guide](https://bkper.com/docs/guides/using-bkper/search-and-queries.md)

## The Bkper Function

The Bkper Function may look complex at first, but the Add-on sidebar can generate it for you. In cell [B5](https://docs.google.com/spreadsheets/d/1_jQHHnoHFjJ4JnuEkJ-zenMLvQSAjiFD8hLZ6TeN6ZI/edit#gid=168077234&range=B5) on the P&L sheet:

```
=BKPER_BALANCES_PERIOD("agtzfmJrcGVyLWhyZHITCxIGTGVkZ2VyGICAwMWc48ELDA", 1, "group:'Net Income' on:2024", 5, TRUE, FALSE)
```

Each parameter serves a purpose:

- **BKPER_BALANCES_PERIOD** — The function that fetches totals for a period (as opposed to a point in time).
- **First parameter** — The [bookid](https://bkper.com/docs/guides/using-bkper/books.md#bookid) identifying the source book.
- **1** — A cache number used to trigger dynamic updates. It is generated and updated automatically; change it manually to force a new fetch.
- **"group:'Net Income' on:2024"** — The [query](https://bkper.com/docs/guides/using-bkper/search-and-queries.md) defining which data to retrieve.
- **5** — The depth level in the group hierarchy to fetch.
- **TRUE** — Transposes the result in the sheet.
- **FALSE** — Controls whether the date column is hidden.

> **Caution: Disclaimer**
> This article is intended as an example and should not be considered professional advice. We recommend working with a local professional — such as a tax advisor or accountant — to ensure compliance with local regulations. Using this guide does not establish a professional-client relationship.
**See also:** [Financial Statements on Google Sheets](https://bkper.com/docs/guides/templates/financial-statements.md)
