# GL Accounts Excel Functions This document lists the Excel functions currently implemented in the GL Accounts proof of concept. ## Common Parameters All functions use the same four parameters: - `companyKey`: company party code or company party name, for example `ICT TRADING`. - `accountCode`: general ledger account code, for example `20011`. - `currencyIso`: transaction currency filter. In the current database this may be the currency id, code, name, symbol, or numeric code, for example `1`, `USD`, or `EUR`. - `valueDate`: accounting cutoff date. Only posted moves up to this date are included. Example parameter shape: ```excel =GetAccountAmount("ICT TRADING","20011","USD",DATE(2026,5,13)) ``` ## Implemented Functions ### GetAccountBaseAmount ```excel =GetAccountBaseAmount(companyKey, accountCode, currencyIso, valueDate) ``` Returns the account balance converted to the company base currency using the currency rate at `valueDate`. ### GetAccountRealBaseAmount ```excel =GetAccountRealBaseAmount(companyKey, accountCode, currencyIso, valueDate) ``` Returns the posted balance already stored in company base currency. ### GetAccountAmount ```excel =GetAccountAmount(companyKey, accountCode, currencyIso, valueDate) ``` Returns the posted balance in transaction currency for the selected currency filter. ### GetAccountAbbr ```excel =GetAccountAbbr(companyKey, accountCode, currencyIso, valueDate) ``` Returns the account abbreviation. In this POC it returns the account code because no separate GL abbreviation field is available. ### GetAccountName ```excel =GetAccountName(companyKey, accountCode, currencyIso, valueDate) ``` Returns the general ledger account name. ### GetAccountContact ```excel =GetAccountContact(companyKey, accountCode, currencyIso, valueDate) ``` Backward-compatible contact formula. It returns contact codes when available, otherwise contact names. ### GetAccountContactCode ```excel =GetAccountContactCode(companyKey, accountCode, currencyIso, valueDate) ``` Returns a comma-separated list of contact party codes found on posted GL lines. If a party has no code, its name is used as fallback. ### GetAccountContactName ```excel =GetAccountContactName(companyKey, accountCode, currencyIso, valueDate) ``` Returns a comma-separated list of contact party names found on posted GL lines. If a party has no name, its code is used as fallback. ## Operational Notes - Only posted account moves are included. - The currency parameter is currently a transaction-currency filter, not an output currency selector. - The VBA module caches results. Use `ClearGLApiCache` after changing database data or SQL functions. - Database calls are disabled after importing the module and after each refresh. Formula cells return `#GLAPI_OFF` outside `RefreshGLApi`. - Use `InstallGLApiFormulas` on the `Functions` sheet to install formulas from formula text into result cells as inert placeholders. Do not remove leading apostrophes manually in Excel's formula bar. - Use `ClearGLApiFormulas` if a previous workbook version already contains live `GetAccount...` worksheet formulas. - Use `CloseGLApiConnection` to force Excel to reopen the ODBC connection. - Use `RefreshGLApi` to enable database calls only during that refresh, clear the cache, evaluate formula text, and write plain values. - Use `DisableGLApi` before editing/copying large formula areas if Excel should not contact the database. - `GetAccountContact` remains available so existing workbook formulas keep working.