Codat.Lending.ExcelReports (codat v1.0.0)

Copy Markdown View Source

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

Summary

Functions

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

Checks the status of a pending Excel report generation.

Functions

download(client_or_company_id, company_or_report_type, report_type_or_opts \\ [])

@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(client_or_company_id, company_or_report_type, report_type_or_opts \\ [])

@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(client_or_company_id, company_or_report_type, report_type_or_opts \\ [])

@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"