# `Codat.Lending.ExcelReports`
[🔗](https://github.com/iamkanishka/codat.git/blob/v1.0.0/lib/codat/lending/lending.ex#L472)

Generate and download Excel-based lending reports.

Codat can generate rich Excel workbooks with financial analysis,
data integrity reports, and audit trails — useful for loan underwriting workflows.

## Report Types

- `"audit"` — Audit report with data integrity and transaction details
- `"enhancedInvoices"` — Enhanced accounts receivable analysis
- `"enhancedCashFlowTransactions"` — Detailed cash flow with banking data

# `download`

```elixir
@spec download(Codat.Client.t() | String.t(), String.t(), String.t() | keyword()) ::
  {:ok, binary() | map() | list() | nil} | {:error, Codat.Error.t()}
```

Downloads a generated Excel report as binary.

## Example

    {:ok, bytes} = Codat.Lending.ExcelReports.download(client, company_id, "audit")
    File.write!("audit-report.xlsx", bytes)

# `generate`

```elixir
@spec generate(Codat.Client.t() | String.t(), String.t(), String.t() | keyword()) ::
  {:ok, map()} | {:error, Codat.Error.t()}
```

Requests generation of an Excel report. This is asynchronous — poll `status/3` to check progress.

## Example

    {:ok, _} = Codat.Lending.ExcelReports.generate(client, company_id, "audit")

# `status`

```elixir
@spec status(Codat.Client.t() | String.t(), String.t(), String.t() | keyword()) ::
  {:ok, map()} | {:error, Codat.Error.t()}
```

Checks the status of a pending Excel report generation.

## Example

    {:ok, status} = Codat.Lending.ExcelReports.status(client, company_id, "audit")
    status["status"]  # => "complete" | "generating"

---

*Consult [api-reference.md](api-reference.md) for complete listing*
