Skip to main content
GET
/
api
/
reports
/
export
Export to Excel
curl --request GET \
  --url https://api.example.com/api/reports/export
{
  "Sheet Name": "<string>"
}
Exports transaction data to an Excel (.xlsx) file with formatted columns and styling.

Authentication

Requires Bearer token authentication via Authorization header.

Query Parameters

accountId
string
Filter transactions by a specific account. If omitted, exports all transactions.

Response

Returns a binary Excel file stream with the following characteristics:
  • Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
  • File Name: movimientos.xlsx
  • Max Records: 2,000 transactions (most recent first)

Excel Format Details

Worksheet Structure

Sheet Name
string
Movimientos (Spanish for “Transactions”)

Columns

ColumnHeaderWidthDescription
AFecha15Transaction date
BTipo12Type (INCOME/EXPENSE)
CCategoría20Category name or ”-” if none
DCuenta20Account name or ”-” if none
EDescripción30Transaction description
FMonto15Amount (numeric)
GMoneda10Currency code

Styling

  • Header Row: Bold white text on dark slate background (#1E293B)
  • Data Rows: Standard formatting with numeric amounts

Example Request

curl -X GET "https://api.yourfinanceapp.com/api/reports/export?accountId=account_123" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -o transactions.xlsx

Example Request (All Accounts)

curl -X GET "https://api.yourfinanceapp.com/api/reports/export" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -o all_transactions.xlsx

Use Cases

  • Data Backup: Download complete transaction history for archival purposes
  • External Analysis: Import into accounting software or spreadsheet tools
  • Tax Preparation: Export annual transactions for tax filing
  • Budget Planning: Analyze spending patterns in Excel pivot tables
  • Reconciliation: Compare exported data with bank statements

Implementation Details

The export service uses ExcelJS library to generate high-quality spreadsheets with:
  • Proper column widths for readability
  • Professional header styling
  • Numeric formatting for amounts
  • Optimized memory usage for large datasets

Performance

  • Query Limit: 2,000 most recent transactions
  • Ordering: Descending by date (newest first)
  • Filters Applied: Excludes soft-deleted transactions (deletedAt IS NULL)

Notes

  • Amounts are stored as numbers (not strings) for Excel calculations
  • Categories and accounts default to ”-” when not assigned
  • Currency field shows the transaction currency or account’s default currency
  • File downloads immediately without requiring additional API calls

Build docs developers (and LLMs) love