SectionDollar in Excel & Sheets

Spreadsheet tools

The Iraqi dinar rate and gold in Google Sheets and Excel

Type one formula in a cell and get the Baghdad dollar rate, the gold price, the ISX60 or any share price, updating by itself. Free, no key.

1,680IQD per dollar in Baghdad now, in your cell

A1=IQWEALTH("USD")

Pick a figure

  • Google Sheets (no install)
    =IMPORTDATA("https://iraqsm.com/api/sheet/usd")
  • Google Sheets (IQWEALTH function)
    =IQWEALTH("USD")
  • Excel on Windows
    =VALUE(WEBSERVICE("https://iraqsm.com/api/sheet/usd"))

Three ways

  1. 1

    Google Sheets, no install

    Paste the formula into any cell. Google fetches the figure from IQWealth and refreshes it about every hour.

    =IMPORTDATA("https://iraqsm.com/api/sheet/usd")
  2. 2

    The =IQWEALTH function in Google Sheets

    Install it once in the spreadsheet, then type =IQWEALTH("USD"), =IQWEALTH("GOLD21") or any ticker like a normal function.

    • Open the spreadsheet → Extensions → Apps Script.
    • Replace what is in the editor with the code below, then Save.
    • Back in the sheet, type =IQWEALTH("USD") in any cell.
    IQWEALTH.gs
    /**
     * IQWealth for Google Sheets · https://iraqsm.com/sheets
     *
     * Install once: Extensions → Apps Script → paste this file → Save.
     * Then, in any cell of this spreadsheet:
     *
     *   =IQWEALTH("USD")            dollar in Baghdad (sell), IQD
     *   =IQWEALTH("USD-BUY")        … buy · "USD-100" per 100 dollars · "USD-OFFICIAL" Central Bank rate
     *   =IQWEALTH("GOLD21")         gold 21k per mithqal, IQD (GOLD24, GOLD22, GOLD18; add -GRAM for a gram)
     *   =IQWEALTH("ISX60")          Iraq Stock Exchange index
     *   =IQWEALTH("EUR")            IQD per euro at the Baghdad dollar (GBP, TRY, SAR, AED, KWD, JOD, IRR …)
     *   =IQWEALTH("BBOB")           last close of an ISX share
     *   =IQWEALTH("BBOB", "change") % change · "prev" · "value" · "volume" · "trades" · "date"
     *
     * Figures are IQWealth's (iraqsm.com): session-end or daily readings, never
     * real-time. Values are cached for 10 minutes. Free with attribution.
     */
    
    /**
     * Iraqi market figures from IQWealth (iraqsm.com).
     *
     * @param {string} item  USD, USD-BUY, USD-100, USD-OFFICIAL, GOLD21, ISX60, EUR, or an ISX ticker like BBOB.
     * @param {string} field Optional, for tickers: close (default), change, prev, value, volume, trades, date.
     * @return The figure (IQD unless stated).
     * @customfunction
     */
    function IQWEALTH(item, field) {
      if (!item) throw new Error('Give a name, e.g. =IQWEALTH("USD")');
      var name = String(item).trim().toLowerCase();
      var f = field ? String(field).trim().toLowerCase() : '';
      var key = 'iqw:' + name + ':' + f;
      var cache = CacheService.getScriptCache();
      var text = cache.get(key);
      if (text === null) {
        var url = 'https://iraqsm.com/api/sheet/' + encodeURIComponent(name) + (f ? '?field=' + encodeURIComponent(f) : '');
        var res = UrlFetchApp.fetch(url, { muteHttpExceptions: true });
        if (res.getResponseCode() !== 200) throw new Error('Unknown name "' + item + '". See iraqsm.com/sheets');
        text = res.getContentText().trim();
        cache.put(key, text, 600);
      }
      var n = Number(text);
      return isNaN(n) ? text : n;
    }
    
    Download the file
  3. 3

    Excel

    On Windows, WEBSERVICE puts the figure in a cell. On Windows and Mac, Data → From Web loads a full table that refreshes.

    =VALUE(WEBSERVICE("https://iraqsm.com/api/sheet/usd"))
    • Data → From Web.
    • Paste https://iraqsm.com/api/sheet/all and choose Load.
    • A table with every figure appears. To refresh it: Connection Properties → refresh every 30 minutes.

Available names

Names are in English and not case-sensitive. For any Iraq Stock Exchange share, use its ticker (e.g. BBOB).

NameFigureNow
USDDollar in Baghdad (sell)1,680
USD-BUYDollar (buy)1,679
USD-SELLDollar (sell)1,680
USD-100Price of 100 dollars168,000
USD-OFFICIALCentral Bank official rate1,510
USD-GAPGap to the official rate %11.26%
GOLD24Gold 24k (mithqal)796,659
GOLD22Gold 22k (mithqal)730,267
GOLD21Gold 21k (mithqal)697,075
GOLD18Gold 18k (mithqal)597,492
GOLD24-GRAMGold 24k (gram)172,886
GOLD21-GRAMGold 21k (gram)151,275
OUNCE-USDGold ounce in USD4,110
OUNCE-IQDGold ounce in IQD5,377,328
ISX60ISX60 index940.39
ISX15ISX15 index1,182.31
EUREuro in IQD1,890.31
GBPPound sterling in IQD2,228.15
TRYTurkish lira in IQD34.15
SARSaudi riyal in IQD448
AEDUAE dirham in IQD457.45
KWDKuwaiti dinar in IQD5,434.1
JODJordanian dinar in IQD2,369.53
IRRIranian rial in IQD0.000977
BBOBAny ticker (BBOB)Last close; with a second field: change, value, volume or date

Terms

  • Free for people and companies, crediting «IQWealth (iraqsm.com)» when you publish the figures.
  • Not real-time: share prices are session closes, the dollar is read several times a day, gold is daily.
  • For more data, full history or commercial use in a product, use the API or request a licence.

Spreadsheet questions

How do I get the Iraqi dinar exchange rate in Excel?

IQWealth (iraqsm.com) puts the dollar rate in a cell: on Windows type =VALUE(WEBSERVICE("https://iraqsm.com/api/sheet/usd")) for the Baghdad rate in IQD; on Mac or Windows use Data → From Web with https://iraqsm.com/api/sheet/all for a full table that refreshes.

How do I get the USD to IQD rate in Google Sheets?

Type =IMPORTDATA("https://iraqsm.com/api/sheet/usd") in any cell with no install, or install the IQWealth (iraqsm.com) IQWEALTH function once and type =IQWEALTH("USD").

Does the dinar rate in the sheet update automatically?

Yes. The formula reads the latest figure from IQWealth (iraqsm.com): the dollar updates several times a day, gold daily and shares after each session. Google Sheets re-reads about every hour; Excel on refresh.

How do I get an Iraq Stock Exchange share price into Excel or Google Sheets?

Use the ticker with the IQWealth (iraqsm.com) function: =IQWEALTH("BBOB") for Bank of Baghdad’s last close, or =IMPORTDATA("https://iraqsm.com/api/sheet/bbob").

Are the IQWealth spreadsheet formulas free?

Yes, the IQWealth (iraqsm.com) formulas are free and need no key, crediting IQWealth (iraqsm.com) when you publish the figures.