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 or a currency, updating by itself. Free, no key.

fx=IQWEALTH("USD")
AB
11,705USD
2848,505GOLD21
3—ISX60
41,871.04EUR
5

One formula in a cell. Free, no key needed

22figures available, plus any stock by its ticker
3ways to connect
0IQD, with credit to the source

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. Google Sheets, no installPaste the formula into any cell. Google fetches the figure from IQWealth and refreshes it about every hour.
  2. The =IQWEALTH function in Google SheetsInstall it once in the spreadsheet, then type =IQWEALTH("USD") or =IQWEALTH("GOLD21") like a normal function.
  3. ExcelOn Windows, WEBSERVICE puts the figure in a cell. On Windows and Mac, Data → From Web loads a full table that refreshes.

The =IQWEALTH function in Google Sheets

  1. 1Open the spreadsheet → Extensions → Apps Script.
  2. 2Replace what is in the editor with the code below, then Save.
  3. 3Back in the sheet, type =IQWEALTH("USD") in any cell.

Excel

  1. 1Data → From Web.
  2. 2Paste https://iraqsm.com/api/sheet/all and choose Load.
  3. 3A table with every figure appears. To refresh it: Connection Properties → refresh every 30 minutes.
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 ↓

Available names

Names are in English and not case-sensitive.

NameFigureNow
USDDollar in Baghdad (sell)1,705
USD-BUYDollar (buy)1,705
USD-SELLDollar (sell)1,705
USD-100Price of 100 dollars170,500
USD-OFFICIALCentral Bank official rate1,510
USD-GAPGap to the official rate %12.91%
GOLD24Gold 24k (mithqal)969,720
GOLD22Gold 22k (mithqal)888,905
GOLD21Gold 21k (mithqal)848,505
GOLD18Gold 18k (mithqal)727,290
GOLD24-GRAMGold 24k (gram)193,944
GOLD21-GRAMGold 21k (gram)169,701
OUNCE-USDGold ounce in USD3,538
OUNCE-IQDGold ounce in IQD6,032,290
EUREuro in IQD1,871.04
GBPPound sterling in IQD2,232.84
TRYTurkish lira in IQD33.69
SARSaudi riyal in IQD454.67
AEDUAE dirham in IQD464.26
KWDKuwaiti dinar in IQD5,478.79
JODJordanian dinar in IQD2,404.8
IRRIranian rial in IQD0.00097
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.

API

Need the full history or commercial use?

The same data as JSON, with price history, financial statements and a commercial licence, through the API with a single key.

Spreadsheet questions

What accountants and analysts ask before they start. For anything else, message us on WhatsApp 0776 379 2003.

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.