Skip to content

kpennell/sheetsdemo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

parse sheets json api data into something react can use.

This is the key:

fetch(API).then(response => response.json()).then(data => { let batchRowValues = data.valueRanges[0].values;

  const rows = [];
  for (let i = 1; i < batchRowValues.length; i++) {
    let rowObject = {};
    for (let j = 0; j < batchRowValues[i].length; j++) {
      rowObject[batchRowValues[0][j]] = batchRowValues[i][j];
    }
    rows.push(rowObject);
  }

Releases

No releases published

Packages

No packages published