let offset = 'A2';
let limit = 'Z999';
const sheetid = "<sheetid>";
const apikey = "<api key>";
const sheetname = "Sheet1";
const url = `https://sheets.googleapis.com/v4/spreadsheets/${sheetid}/values/${sheetname}!${offset}:${limit}?key=${apikey}`;
var sheet_data = [];
fetch(url).then(data => data.json()).then(data => {
sheet_data = data.values;
console.table(sheet_data);
});
- https://docs.google.com/spreadsheets/d/sheetid/edit?usp=sharing
- create/get apikey from https://console.developers.google.com/apis/credentials
- in https://console.developers.google.com
Go to > Libraries > Google Sheets > Enable
Sample Google Sheet Data

To get sheet id
Click on share then copy link

Create API Key

Final Output in HTML
