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.
=IQWEALTH("USD")| A | B | |
|---|---|---|
| 1 | 1,705 | USD |
| 2 | 848,505 | GOLD21 |
| 3 | — | ISX60 |
| 4 | 1,871.04 | EUR |
| 5 |
One formula in a cell. Free, no key needed
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
- Google Sheets, no installPaste the formula into any cell. Google fetches the figure from IQWealth and refreshes it about every hour.
- The =IQWEALTH function in Google SheetsInstall it once in the spreadsheet, then type =IQWEALTH("USD") or =IQWEALTH("GOLD21") like a normal function.
- 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
- 1Open the spreadsheet → Extensions → Apps Script.
- 2Replace what is in the editor with the code below, then Save.
- 3Back in the sheet, type =IQWEALTH("USD") in any cell.
Excel
- 1Data → From Web.
- 2Paste https://iraqsm.com/api/sheet/all and choose Load.
- 3A table with every figure appears. To refresh it: Connection Properties → refresh every 30 minutes.
/**
* 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.
| Name | Figure | Now |
|---|---|---|
USD | Dollar in Baghdad (sell) | 1,705 |
USD-BUY | Dollar (buy) | 1,705 |
USD-SELL | Dollar (sell) | 1,705 |
USD-100 | Price of 100 dollars | 170,500 |
USD-OFFICIAL | Central Bank official rate | 1,510 |
USD-GAP | Gap to the official rate % | 12.91% |
GOLD24 | Gold 24k (mithqal) | 969,720 |
GOLD22 | Gold 22k (mithqal) | 888,905 |
GOLD21 | Gold 21k (mithqal) | 848,505 |
GOLD18 | Gold 18k (mithqal) | 727,290 |
GOLD24-GRAM | Gold 24k (gram) | 193,944 |
GOLD21-GRAM | Gold 21k (gram) | 169,701 |
OUNCE-USD | Gold ounce in USD | 3,538 |
OUNCE-IQD | Gold ounce in IQD | 6,032,290 |
EUR | Euro in IQD | 1,871.04 |
GBP | Pound sterling in IQD | 2,232.84 |
TRY | Turkish lira in IQD | 33.69 |
SAR | Saudi riyal in IQD | 454.67 |
AED | UAE dirham in IQD | 464.26 |
KWD | Kuwaiti dinar in IQD | 5,478.79 |
JOD | Jordanian dinar in IQD | 2,404.8 |
IRR | Iranian rial in IQD | 0.00097 |
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.
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.