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
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;
}
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).
Name
Figure
Now
USD
Dollar in Baghdad (sell)
1,680
USD-BUY
Dollar (buy)
1,679
USD-SELL
Dollar (sell)
1,680
USD-100
Price of 100 dollars
168,000
USD-OFFICIAL
Central Bank official rate
1,510
USD-GAP
Gap to the official rate %
11.26%
GOLD24
Gold 24k (mithqal)
796,659
GOLD22
Gold 22k (mithqal)
730,267
GOLD21
Gold 21k (mithqal)
697,075
GOLD18
Gold 18k (mithqal)
597,492
GOLD24-GRAM
Gold 24k (gram)
172,886
GOLD21-GRAM
Gold 21k (gram)
151,275
OUNCE-USD
Gold ounce in USD
4,110
OUNCE-IQD
Gold ounce in IQD
5,377,328
ISX60
ISX60 index
940.39
ISX15
ISX15 index
1,182.31
EUR
Euro in IQD
1,890.31
GBP
Pound sterling in IQD
2,228.15
TRY
Turkish lira in IQD
34.15
SAR
Saudi riyal in IQD
448
AED
UAE dirham in IQD
457.45
KWD
Kuwaiti dinar in IQD
5,434.1
JOD
Jordanian dinar in IQD
2,369.53
IRR
Iranian rial in IQD
0.000977
BBOB
Any 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.