Pushin data to ID from JSON

Hello,

I’m currently pulling JSON data in my console from google-sheets-api like this:

var request = gapi.client.sheets.spreadsheets.values.batchGet(params);
      request.then(function(response) {
        // TODO: Change code below to process the `response` object:
        console.log(response.result);

this puts out the following:

{spreadsheetId: "1dbRAXK6EVbSIFWB5mKleh2ziutwavrRLvs07uoBPJbk", valueRanges: Array(1)}
spreadsheetId: "1dbRAXK6EVbSIFWB5mKleh2ziutwavrRLvs07uoBPJbk"
valueRanges: Array(1)
0:
majorDimension: "ROWS"
range: "'ma1'!A1:J38"
values: Array(38)
0: (10) ["maandag 1 april 2019", "", "", "", "", "", "", "", "", "week IV"]
1: (10) ["kafee", "naam", "functie", "van", "tot", "van", "tot", "Subtotaal", "totaal", "Info"]
2: Array(10)
0: ""
1: "Ine"
2: ""
3: "9:30"
4: ""
5: ""
6: "18:00"
7: "8,5"
8: "8"
9: "Reservaties/opmerkingen"
length: 10
__proto__: Array(0)
3: Array(9)
0: ""
1: "Michiel"
2: ""
3: "9:30"
4: ""
5: ""
6: "17:30"
7: "8"
8: "7,5"
length: 9
__proto__: Array(0)
4: (9) ["", "Nayimi", "BT", "12:00", "", "", "21:00", "9", "8,5"]
5: (7) ["", "Gijs", "", "12:00", "", "", "18:00"]
6: (7) ["", "Flavio", "", "12:00", "", "", "21:00"]
7: (9) ["", "", "", "", "", "", "", "0", "0"]
8: (7) ["", "Tim", "V", "9:30", "", "", "18:00"]
9: (10) ["", "Griet", "V", "9:30", "", "", "18:00", "8,5", "8", "Activiteiten/voorstellingen"]
10: (10) ["", "Silvia", "V", "9:30", "", "", "18:00", "8,5", "8", "Gent Quizt"]
11: (9) ["", "Roeland", "", "17:30", "", "", "2:00", "8,5", "8"]
12: (9) ["", "Hannah", "", "17:30", "", "", "2:00", "8,5", "8"]
13: (9) ["", "Ali", "", "17:30", "", "", "2:00", "8,5", "8"]
14: (9) ["", "Emma", "", "18:00", "", "", "2:00", "8", "7,5"]

Currently I’m giving <div id="example"></div> to push the data to the id in the div.
Like this:

document.getElementById("example").innerHTML = response.result.valueRanges[0].values[0][0];

Which gives me a div with the result of JSON request data.

Is it possible (and how do I achieve this) to either

1: to loop thru a specific part of the array (ex: arrays 0 - 6) and get every repeating value of those arrays (ex: array 0 - value 3, array 1 - value 3, array 2 - value 3, and so one)
And push these data values to a new div element. So when there is data in the array it makes a new div element containing that data and if there is not it does not make a new element containing no data.

or

2: like i tried to do with this code but then better:

const object1 = { 0: response.result.valueRanges[0].values[2][1] , 1: response.result.valueRanges[0].values[2][3], 2: response.result.valueRanges[0].values[2][6], 3: response.result.valueRanges[0].values[2][7]};
console.log(Object.entries(object1));

document.getElementById("examplefirstdiv","exampleseconddiv", "examplethirddiv" ).innerHTML = object1;

which results in this in the console:

(4) [Array(2), Array(2), Array(2), Array(2)]0: Array(2)0: "0"1: "Ine"length: 2__proto__: Array(0)1: Array(2)0: "1"1: "9:30"length: 2__proto__: Array(0)2: Array(2)0: "2"1: "18:00"length: 2__proto__: Array(0)3: Array(2)0: "3"1: "8,5"length: 2__proto__: Array(0)length: 4__proto__: Array(0)

To try to push the data pulled from json to the correct ID’s (almost the same as question one, but this one I already worked on. 1 is the idea of how I think it should be done)

I hope this is clear and there is somebody with time to help me with this.

I don’t quite understand your intention but I think a start would be to get the array you want from the object

let array = response.result.valueRanges[0].values[0]

//array === ["maandag 1 april 2019", "", "", "", "", "", "", "", "", "week IV"]

Then these are some ways you can loop over a array.
You can use map to return the items of the array you want into a new array.