JSFiddle - React, Tailwind, and code Playground

by Alex Cowan

JavaScript

thegid = 0;
theid = '1DA6htKy-Z-8QRkifkLbzlzG2r5YWOKE77JXEJNmq45g';

var requrl = `https://docs.google.com/spreadsheets/d/${theid}/gviz/tq?tqx=out:json&tq&gid=${thegid}`


function getJson(id, gid) {
  var txt = fetch(`https://docs.google.com/spreadsheets/d/${id}/gviz/tq?tqx=out:json&tq&gid=${gid}`);
  //var jsonString = txt.match(/(?<="table":).*(?=}\);)/g);
  //var json = JSON.parse(jsonString)
  return (txt);
}

/*




//string = getJson(theid, thegid);
//console.log(string);


/*



fetch('https://opensheet.vercel.app/1DA6htKy-Z-8QRkifkLbzlzG2r5YWOKE77JXEJNmq45g/Sheet1')
  .then(res => res.json())
  .then(data => {
    data.forEach(row => {
      // Do something with each row here.
      console.log(row);
    })
  })

  
    https://docs.google.com/spreadsheets/d/1DA6htKy-Z-8QRkifkLbzlzG2r5YWOKE77JXEJNmq45g/gviz/tq?tqx=out:json&tq&gid=$0
  */