Home > Net >  Google Sheets, Web scrape Best Buy Price
Google Sheets, Web scrape Best Buy Price

Time:02-11

im trying to figure out how to web scrape the price of a product into google sheets. Before i would use =importrange(A1,B1)

And have A1 = enter image description here

you can do it by this way

function bestbuy(source) {
  const obj = JSON.parse(source);
  const v = obj.offers.offers;
  const header = Object.keys(v[0]);
  return [header, ...v.map(o => header.map(h => Array.isArray(o[h]) ? o[h].join(",") : o[h]))];
}

In walmart, the situation is quite different, you have also a json but you can't fetch through google since there is a captcha.

enter image description here

  • Related