AYFI / Blog

Importing your books into Pre130: the button mix-up and four XLSX rules that blocked our upload

Nick · · Figures as per the rules in force on

Pre130 accepts an XLSX file up to 4 MB using the PLANTILLA_LIBROS_UNIFICADOS.xlsx template (three header rows), with date cells as dates and number cells as numbers, and a NIF on every expense row. After a successful import, you must still add the 5 % gastos de difícil justificación (RIRPF art. 30.2ª, capped at 2,000 €) to [02] and enter the 100 € minoración in [13] by hand.

If you are newly registered as an autónomo in Spain, Pre130 is AEAT's online portal for filing Modelo 130 — the quarterly IRPF advance payment that self-employed people under the simplified direct assessment regime make four times a year. The portal lets you upload a spreadsheet of your income and expenses (libros registro) so the form fills itself. In theory it is straightforward. In practice, on 13 October 2026, AYFI's file was rejected three times before the fourth attempt was accepted.

This article covers exactly what went wrong and what the import still leaves for you to fix by hand.

What Pre130 expects from your books

The file must be an XLSX, no larger than 4 MB, built from the official template PLANTILLA_LIBROS_UNIFICADOS.xlsx — not LSI.xlsx (the technical design specification template), which looks similar but has a different header structure.

The workbook needs two sheets inside the same file:

Each sheet uses three header rows: group, field name, and data type. Your actual records start on row 4 and must cover from 1 January through the last day of the quarter you are declaring. That means a 3Q filing includes everything from January through September, not just the summer months.

The cell types matter. Row 3 of the header declares whether each column is a date, a number, or text. Pre130 validates the data against those declarations. A date stored as a text string, or a number formatted as text, will fail this check with no clear pointer to the offending cell.

The button to use — and the one to avoid

This is the most disorienting part of the Pre130 interface. There are two buttons that both say something about importing, and they do completely different things.

When you open the Modelo 130 form, AEAT automatically opens a Libros registro dialog. Inside that dialog is the button «Importar libro registro». This is the correct button. It opens a file picker that accepts your XLSX.

Separately, at the bottom of the main declaration form, there is a plain «Importar» button. This button accepts a plain-text file encoded in ISO-8859-1 following AEAT's technical record layout — a format used for batch submissions, not for spreadsheets. If you upload your XLSX there, Pre130 returns the message: «Asegúrese que el fichero es de texto y con el código de caracteres ISO-8859-1». The natural reading of that message is "your file is broken," but the file is fine — you just used the wrong button.

One more tip: if you normally browse the Sede Electrónica with Chrome and have auto-translate enabled, turn it off before working in Pre130. Chrome maps «Libros registro» to "ship's logbooks" and «Validar declaración» to "Validate the declaration" — which is harmless in isolation but makes it harder to follow any written guide. The AEAT portal is designed for Spanish; use it in Spanish.

Four format errors that blocked our import

AYFI uploaded its books on 13 October 2026. The Sede rejected the file three consecutive times before logging: «Fichero validado correctamente, registros procesados 7, incluidos 7» on the fourth attempt. Here is what caused each rejection, in the order they appeared:

1. Wrong header template. The first file used LSI.xlsx, which has ten header rows. Pre130 treats row 4 as the first data row and tries to parse the fourth header row as a ledger entry. The error read: «error de tipo o estructura… fila [10], columna [8]… El carácter I no es un dígito decimal». Switching to PLANTILLA_LIBROS_UNIFICADOS.xlsx (three header rows) cleared this immediately.

2. Wrong cell types. After fixing the template, the next rejection came silently — no specific cell flagged, just a type mismatch. Dates were stored as text strings; currency amounts were number-formatted text. Every date column needs a real Excel date cell; every amount column needs a real number cell. Format the cells explicitly in your spreadsheet before exporting.

3. RETA payment with type SF. Document type SF (ajuste por prorrata) is reserved for IVA ratio adjustments. The monthly Social Security payment under the autónomo scheme — RETA — must use type F6 (contable justificante) with NIF Q2827003A (Tesorería General de la Seguridad Social). Pre130 rejects SF in the IRPF expense book because the field belongs to a different tax altogether.

4. NIF missing from expense rows. Every expense line needs the NIF of the issuer, including small receipts filed as type F2 (simplified invoice). Without it, Pre130 returns: «Es obligatorio consignar la identificación del expedidor» and rejects the entire file — not just the offending row. Collect the NIF when you log the expense, not on the filing deadline.

Two fields the import always leaves blank

Even when your file passes all four checks, the import does not complete the form. Two fields require manual input every time.

Gastos de difícil justificación — field [02] top-up

RIRPF art. 30.2ª allows autónomos under simplified direct assessment to deduct 5 % of net income as a lump-sum provision for expenses that are hard to document individually. The calculation is: (income − book expenses) × 5 %, and the deduction is capped at 2,000 € per year.

This amount has no supplier, no NIF, and no invoice — it never appears in the libro de gastos. Pre130 copies your book total into [02] but does not add this provision. You calculate it from the numbers already on screen and add it to [02] yourself.

Minoración — field [13]

RIRPF art. 110.3 provides a 100 € reduction a quarter for autónomos whose net business income in the previous year did not exceed 9,000 €. What counts is last year, not the running total in [03]. Pre130 leaves [13] blank after every import; if last year qualifies, enter 100 € in [13] manually.

The numbers from the 3Q 2026 filing

The table below shows what Pre130 displayed immediately after the import, and what the final values were after both manual adjustments. These are real figures from AYFI's third-quarter 2026 Modelo 130:

Field Description After import After adjustments
[01] Cumulative income 7,713.00 € 7,713.00 €
[02] Expenses (book + difícil) 265.68 € 638.05 €
[03] Net income 7,447.32 € 7,074.95 €
[04] Advance payment at 20 % 1,489.46 € 1,414.99 €
[13] Minoración 0.00 € 100.00 €
[19] Amount due 1,489.46 € 1,314.99 €

The difference between signing after the import and signing after the adjustments is 174.47 €. Both deductions — the 5 % provision and the 100 € minoración — are explicitly provided by law. The import does not apply them; you do.

AYFI tracks the income and expenses that feed these fields throughout the quarter. When the filing date arrives, the numbers are already reconciled and the two manual adjustments take under two minutes.

If you are used to filing once a year at home

In the UK, a sole trader keeps their records and sends one Self Assessment return after the tax year ends; in the US, quarterly estimated payments are a cheque or a transfer with no ledger attached. Spain asks for both at once: an advance every quarter, worked out from books that run from 1 January to the end of that quarter, in the template the tax agency publishes.

That changes how you keep records. A receipt photographed in March but entered in October still has to sit in the first-quarter rows, with the supplier's NIF, or the import fails on the whole file. An invoice to a client in London or New York is fine in English, but its line in the book follows the Spanish layout, with the client's tax number in its own column.

Two practical points the Sede does not explain: the portal is in Spanish, and browser auto-translation renames the buttons, so the import dialog becomes hard to find. Turn translation off for agenciatributaria.gob.es before you start, and sign in with your digital certificate or Cl@ve, not with the passport number you used at the consulate.

Frequently asked questions

Which button do I click to upload my XLSX books into Pre130?
Use «Importar libro registro» inside the Libros registro dialog — the one that opens automatically when you enter the Modelo 130 form. The separate «Importar» button at the bottom of the form is for plain-text ISO-8859-1 declaration files only; sending an XLSX there produces a character-encoding error that has nothing to do with your file.
How do I record my RETA (Social Security) payment in the expense book?
Use document type F6 (contable justificante) with NIF Q2827003A (Tesorería General de la Seguridad Social). Type SF is reserved for IVA prorate adjustments and is rejected on IRPF expense rows. The RETA payment needs a NIF just like every other expense line.
What is the 5 % gastos de difícil justificación and why does Pre130 not add it?
It is a statutory deduction equal to 5 % of net income before the deduction itself, capped at 2,000 € per year under RIRPF art. 30.2ª. It has no supplier NIF and therefore no place in the book — it is a formula result, not a ledger entry. You add the amount manually to field [02] after the import.
My net income last year was below 9,000 € — is there an extra reduction I can apply?
Yes. RIRPF art. 110.3 grants a minoración of 100 € a quarter when your net business income of the previous year did not exceed 9,000 €; it depends on last year, not on field [03]. Pre130 leaves field [13] blank after an import and does not calculate this for you. Enter 100 € there yourself before submitting.

Sources

Work out your quarter with AYFI, free

General information, not a substitute for a professional. AYFI files nothing for you.

More articles