# Import journals, opening balances and migrate from another system

> One screen for bringing books into the ledger: the previous system's trial balance as one opening entry, journal entries from CSV or spreadsheet files of any length, and the migration checklist for Zoho Books, QuickBooks Online, Xero and Tally with the chart of accounts import, learned account names and external trial balance snapshots. Every import is previewed first and can be undone for five minutes.

Source: /help/en/accounting/import-journals-and-opening-balances

**Reports → Import and migration** (also **Settings → Company → Accounting → Import and migration**) has three tabs: **Opening balances**, **Journal entries** and **Migration**. The ledger must be enabled; see [Enable the ledger](/help/en/accounting/enable-the-ledger). On every tab the file is read in the browser, the database shows you what it would book, and nothing is written until you confirm. Owners, admins and accountants import; viewers can preview.

The **Source system** selector (CSV or spreadsheet, Zoho Books, QuickBooks Online, Xero, Tally) does three things: it reads the column names that system uses, it reads dates the way that system writes them (QuickBooks: month first), and it applies the **account names learned** from your earlier imports of that source.

## Opening balances

When you start keeping books in Alya Books, the balances of your previous system come in once, as one entry in the **opening journal** dated the day before the ledger start. For five minutes afterwards you can undo it so that nothing remains; after that it is reversed like any other entry.

1. Click **Choose a file** and pick the trial balance exported from your previous system (`.xlsx`, `.xls` or `.csv`). **Download a sample workbook** shows the columns. The page tells you how many rows it read and which columns it found.
2. Check the options: **Source system**, **As of** (the entry date, by default the day before the ledger start), how a **single signed column** reads, whether the **difference** books to 3900 Opening balance equity, whether **contacts named in the file are created**, and, when an opening balance is booked already, **Replace**.
3. Click **Preview**. The table shows every line as it will be booked: account, contact, due date, document, currency and the debit or credit. Rows that cannot be imported are listed with the reason; for an unknown account, pick the account it should go to under **Account mapping** (the picker searches by code or name) and preview again. The mapping is remembered for the source.
4. Click **Import opening balances** and confirm. The entry is posted at once; the card at the top shows its number, date and total, and **Undo the import** for five minutes.

### File layouts

The reader accepts the three shapes trial balances come in. Column names are matched in any case; `Account`, `Account code`, `Code`, `Account number`, `Particulars` (Tally) or `Ledger` give the code or name, `Account name`, `Name` or `Description` the name.

| Layout | How it is read |
|---|---|
| **Two columns** (`Debit`, `Credit`) | Each row books on the side that carries an amount. A total row (`Total`, `Grand total`) is skipped. |
| **Single signed column** (`Amount`, `Balance`, `Closing`, `Net`) | `1,250.00 Dr`, `1,250.00 Cr`, `(1,250.00)` and `-1250` all read. Without a suffix: under a section heading, a positive amount sits on the section's side; otherwise **Automatic** takes positive as debit. Choose **Positive = the account's normal side** for Zoho Books and Tally exports, **Positive = debit** for QuickBooks. |
| **Sectioned** | A row that carries only a label (`Assets`, `Liabilities`, `Equity`, `Income`, `Expenses`, or the Arabic words) opens a section; positive amounts under Liabilities, Equity and Income are credits. A `Section` column does the same. |

Accounts are resolved by code first, then by a cell such as `1200 Trade receivables`, then by the English or Arabic name, then by the learned names of the source. **Account mapping** overrides all of them for the codes or names you map.

### Receivable and payable rows

The balance of a control account is the sum of what each customer still owes (or what you owe each supplier). Import it **one row per open document** on 1200 Trade receivables or 2000 Trade payables, with:

- `Contact` (or `Customer`, `Supplier`): the name as it is in Alya Books, or a `Contact id`. A name that does not exist yet is created when **Create customers and suppliers named in the file** is on.
- `Due date`: so the line ages from day one in [Ageing](/help/en/accounting/ar-ageing-and-statements).
- `Document` (or `Invoice`, `Bill`, `Reference`): the number of the migrated document. A payment recorded later on that document, once the document itself exists in Alya Books with the same number and customer, settles this line under the opening entry's number.
- `Currency` and `Amount currency` for a foreign-currency balance (the debit or credit stays in AED).

### Guards and undo

- **opening_not_first**: the opening balance must be the first entry of the books; when a posted entry is dated on or before the as-of date the import is refused.
- **opening_exists**: one opening balance per organisation; tick **Replace** to undo (within its window) or reverse the earlier one.
- **opening_unbalanced**: when the difference may not book to equity, an unbalanced file is refused. **invalid_account**: any unresolved row refuses the whole import.
- **Undo** for five minutes deletes the entry and its lines (`ledger.opening_undone` in the audit log); refused once a payment settles one of its lines (`opening_in_use`). After five minutes: `undo_window_closed`, reverse the entry from **Journal Entries** or import again with **Replace**.

## Journal entries

The **Journal entries** tab imports journal lines from a CSV or spreadsheet of **any length**. Each line names an account and a debit or credit; the lines are grouped into entries and each entry is checked on its own, so one entry that does not balance never stops the others.

1. **Choose a file** or **Download a sample workbook**. Columns, in any case: `Entry` (or `Journal number`, `Num`, `Voucher number`), `Date`, `Reference`, `Description` or `Narration`, `Account` (code, `code name` or name), `Debit` and `Credit` (or one signed `Amount`), and optionally `Journal`, `Contact`, `Due date`, `Document`, `Currency`, `Amount currency` and `Tax` (the VAT rate's name, code or percentage).
2. Options: **Source system**, the **Journal** the entries book in (a `Journal` column overrides it; the opening journal is refused), **Dates in the file**, how a **single signed amount column** reads, whether contacts named in the file are created, and **Save as drafts**.
3. **Preview**. The summary says how many entries and lines were read and how many are ready. Below it: **Accounts not found** (map them under **Account mapping**, where each picker searches the chart by code or name, and preview again; the mapping is remembered for the source), **Entries that will not post** with the row and the reason, warnings, and the table of entries. Open an entry's lines with the arrow at the start of its row.
4. **Import n entries** and confirm. A long file is sent in parts that never split an entry; the button shows the part being booked. The toast says how many entries were booked and refused and until when the batch can be undone.

### Keeping the file's entry numbers

Owners and admins see one more option, **Keep the file's entry numbers**: each entry is booked under the number in its `Entry` column instead of the journal's next number, so a ledger migrated from another system keeps its references. The journal's counter continues after the highest kept number that fits the journal's pattern (`MISC/2026/0042` moves the general journal to 0043; `JE-0042` leaves it alone). A number already used in your books refuses that entry only (`number_taken`); an entry without an entry column takes a fresh number; the option is not available together with **Save as drafts**, since a draft takes its number when it posts. Over the API the flag is `keepNumbers` on `POST /ledger/imports/journals` and on the `import_journal_entries` tool, for a key with `settings:write`; an assistant acting for an accountant is refused (`capability_required`).

### How lines become entries

- A row with a value in the entry column joins the entry of that number. Without an entry column, the date, reference and narration make the key.
- A row with **neither an entry number nor a date continues the entry above it**: QuickBooks and Tally exports write the date and number on the first line only.
- Rows with amounts and no account, name or description are totals and are skipped; so are rows whose label starts with `Total`.
- The entry's date is the first date among its rows; its description is the narration, or the first line's description; its reference is the `Reference` column or the entry number.
- Dates read as ISO (`2026-01-15`), `YYYYMMDD`, Excel serial numbers, `15/01/2026`, `15-Jan-2026` and `Jan 15, 2026`. With **Automatic**, a day above 12 decides the order and day-first is the default; pick **Month / day / year** for US exports (the default when the source is QuickBooks).
- A VAT rate named on a line (`Standard Rate (5%)`, `5%`, `Zero Rated`, `Exempt`, `Reverse charge`) sets the line's rate; a name that is not known here is reported as a warning and the line books without a rate.

### What is reported, per entry

| Reason | Meaning |
|---|---|
| `entry_unbalanced` | debits and credits of the entry differ; the difference is shown |
| `unknown_account`, `account_archived` | a line names an account that is not here, or is archived; map it |
| `invalid_date`, `entry_before_ledger_start` | the date did not read, or is before the ledger start date (set it earlier in Settings to import older history) |
| `journal_reserved`, `journal_inactive` | the `Journal` column names the opening journal or a journal that is switched off |
| `unknown_contact`, `invalid_due_date`, `invalid_contact` | a contact id or due date did not resolve, or a named contact may not be created |
| `period_locked` | the entry's period is locked; see [Period locks](/help/en/accounting/period-locks-and-partial-unlock) |

Every entry that reads clean is booked through the same function as a manual journal, under the next number of its journal, with `import` as its module and the batch recorded on it. With **journal approval** switched on in the ledger settings the entries are saved as drafts for the Approvals inbox instead of posting.

### Recent imports: undo and reverse

Below the import, **Recent imports** lists every batch with what it booked and refused. **Undo** is available for **five minutes** after the batch's last posting: every entry of the batch is deleted so that nothing remains (`ledger.import_undone` in the audit log). It is refused once a payment settles one of the imported lines or an entry was reversed (`import_in_use`). After five minutes **Reverse** posts the mirror of every posted entry, each under the next number, and deletes drafts. **Open** shows the batch's entries in Journal Entries.

### A whole book as one job

A long file (a year of vouchers, a Tally day book) does not have to be sent in parts. Over the API or through an assistant, the file goes to the **document hub** once (upload it in the hub, through an upload link, or with `upload_document`) and `start_ledger_import` (`POST /ledger/imports/jobs` with `fileId`) reads it on the server: the same preview as above, with nothing booked, and the rows kept on the server with the job. `confirm_ledger_import` then hands the job to the scheduler, which posts it within a minute, a hundred entries at a time, each entry once, into **one batch**. `get_ledger_import` shows the progress (`job.done` of `job.entries`) and, once posted, the batch's five-minute undo window; **Recent imports** lists the job like any batch, with its state. A Tally XML file first creates its chart and (with `openingAsOf`) its opening balance, then queues the vouchers.

- **On this page** a file of more than **500 entries** is booked this way by itself: after you confirm, a note says the import was started, you can leave the page, and **Recent imports** shows **Booking** with the entries done, then **Booked**. A job an assistant started and left waiting shows **Waiting for confirmation** with **Confirm**; **Cancel** stops one that waits or is being booked. Choosing the same file again asks **Import this file again?** first.
- The same file started again is refused (`import_duplicate_file`) while a job of it is previewed, posting or posted; `force` starts it once more.
- A job can be cancelled while it posts: the entries already booked stay in the batch and its undo window opens; undo or reverse the batch as a whole (`import_posting` while it still runs).
- A job that fails (for example because the member who started it lost the right to post) stops with `job.error`; what posted stays.
- Spreadsheets are read in the app, which sends their rows; the server reads CSV, JSON and Tally XML. The file's rows are kept for 30 days after the job ends.

## Migration

The **Migration** tab is the checklist for moving books from **Zoho Books**, **QuickBooks Online**, **Xero**, **Tally** or a spreadsheet. Pick the source; each step shows where the export comes from in that system and whether it is done here:

1. **Chart of accounts**: the previous system's account list. Accounts with the same code or EN/AR name as one here are kept; **Accounts receivable**, **Accounts payable**, **Output VAT** and **Input VAT** link to the control accounts rather than doubling them; the rest are created with their code or the next free code of their type (Zoho "Other Current Liability", QuickBooks detail types, Xero `CURRLIAB`, Tally groups such as "Sundry Debtors" and "Duties & Taxes" are understood; pick a type for words that are not). Inactive accounts are skipped. Every name is **remembered for the source**, so the trial balance and journals of that system resolve by the names in their files.
2. **Opening balances**: the closing trial balance, as above.
3. **Historical journals**: the journal export, as above. The ledger start date decides how far back history can go.
4. **Customers, items and invoices**: customers and items come in from **Import Data**; open invoices issued before the ledger start are settled against their opening lines when paid.

**Tally** exports XML rather than spreadsheets: export the Masters (List of Accounts) and the Day Book, pick the file under **Tally XML**, and the page reads it into the three imports. In Tally, the Masters come from **Gateway of Tally → Display More Reports → List of Accounts**, then **Alt+E** (Export) with the format **XML** and all ledgers; the Day Book from **Display More Reports → Day Book**, **Alt+E**, format **XML**, with the period set to the years you are bringing over (older Tally editions name the menu **Display**). Import the two files one after the other. Ledgers under Sundry Debtors and Sundry Creditors become contacts on the receivable and payable control accounts (bill-wise balances one row each, with the bill's number and due date); other ledgers become accounts under their primary group; vouchers become journal rows, with **Sales** vouchers left out by default because they are imported as invoices from **Connectors → Tally**. Tally writes `Dr` amounts as negatives; the reader knows.

**Learned account names** lists what each source calls an account and the account it goes to here, with how often it was used; **Forget** a line to be asked again. The API and AI assistants see the same list (`GET /ledger/import-mappings`, `save_import_mappings`).

**External trial balance** keeps a trial balance **as it was read, without booking anything**: for a client whose books are kept elsewhere, for example to prepare the corporate tax computation. Lines that match an account here are resolved; the rest stay as external lines with the file's own code and name. Snapshots are listed with their date, label and totals and can be deleted; they work for an organisation whose ledger is not enabled.

## Good to know

- Imported entries carry `source_type` `module`, `module_code` `import` and the batch id; the audit log records `ledger.journals_imported`, `ledger.chart_imported`, `ledger.import_undone`, `ledger.import_reversed` and `ledger.trial_balance_snapshot`.
- An entry already booked by the same batch (a part sent twice) is skipped, not booked again.
- The API offers `POST /ledger/imports/journals/preview` and `POST /ledger/imports/journals` (with `batchId` to continue a batch), `POST /ledger/imports/chart/preview` and `POST /ledger/imports/chart`, `GET /ledger/imports`, `DELETE /ledger/imports/{id}` (undo), `POST /ledger/imports/{id}/reverse`, `GET`/`PUT` `/ledger/import-mappings`, `GET /ledger/import-sources` and `/ledger/trial-balance-snapshots`; AI assistants use `preview_journal_import`, `import_journal_entries`, `undo_ledger_import`, `reverse_ledger_import`, `preview_chart_import`, `import_chart_of_accounts`, `list_import_sources`, `save_import_mappings` and `import_trial_balance_snapshot`.
