Don't miss Top trending amazing Compare MacBook Prices Worldwide with Google Sheets 24

Which nation presents the most cost effective costs for Apple MacBooks? Use Google Sheets to check costs of MacBooks in numerous international locations.

Seeking to purchase the brand new Macbook Professional with M3 chips? Questioning if it could be cheaper to buy a Macbook in your native Apple retailer, or ask a buddy who’s travelling from Singapore or Japan to deliver one for you?

Right here’s a Google Sheet that may assist you to evaluate costs of MacBooks in numerous international locations. It takes the present costs of MacBooks from Apple on-line shops in numerous international locations and converts them to a standard forex (US {Dollars}). The trade charges are fetched immediately from Google Finance so the costs will replace routinely when the trade charges change.




Macbook Prices worldwide

How the Macbook Value Comparability Sheet Works

I’ve written a Node.js script that fetches the present costs of MacBooks from the Apple web site and writes them to Google Sheets. Right here’s the code that scrapes the Apple web site and parses the HTML to extract the costs.

Get Macbook Costs from Apple Web site

Apple makes use of JSON-LD to embed structured pricing information of their internet pages that may be simply parsed utilizing cheerio. If the costs weren’t embedded within the wepage, an headless browser like Puppeteer would have been required to scrape the info.

const fs = require('fs');const cheerio = require('cheerio');const areas = ['us', 'in', 'sg', 'uk', 'ae', 'jp'];const scrapeAppleStore = async (area) => {  const url = `https://www.apple.com/${area}/store/buy-mac/macbook-pro`;  const response = await fetch(url);  const html = await response.textual content();  const $ = cheerio.load(html);  const nation = $('a.as-globalfooter-mini-locale-link').textual content().trim();  const information = [];  $('script[type="application/ld+json"]').every((i, elem) => {    const json = JSON.parse($(elem).textual content());    if (json['@type'] === 'Product') {      json.presents.forEach((provide) => {        const { priceCurrency, worth, sku } = provide;        information.push([country, sku.substring(0, 5), price, priceCurrency]);      });    }  });  return information;};(async () => {  const guarantees = areas.map(scrapeAppleStore);  const values = await Promise.all(guarantees);  const costs = values.filter((worth) => worth.size > 0);  fs.writeFileSync('costs.json', JSON.stringify(costs, null, 4));})();

Get Foreign money Trade Charges from Google Finance

The following step is to transform the costs of MacBooks in numerous currencies to a standard forex (US {Dollars}). The trade charges are fetched from Google Finance utilizing the GOOGLEFINANCE perform of Google Sheets.

=BYROW(A1:A27, LAMBDA(e, IF(e="USD",1, GOOGLEFINANCE("CURRENCY:USD"&e))))

The perform accepts the forex code of the supply and goal currencies and returns the trade charge. For example, the formulation =GOOGLEFINANCE("CURRENCY:USDINR") will fetch the present trade charge of US {Dollars} to Indian Rupees.




Google Finance - Currency Exchange Rates

Construct the Macbook Value Comparability Sheet

Now that now we have costs in a standard present, we will construct the worth comparability desk utilizing the INDEX MATCH perform of Google Sheets. The lookup standards consists of two columns – the SKU of the Macbook mannequin and the nation. The related formulation is:

=INDEX(Information!$A$1:$E$648,MATCH($A3&B$1,Information!$A:$A&Information!$C:$C,0),5)

Additionally see: Monitor iPhone Inventory with Google Sheets

Post a Comment

Previous Post Next Post