Home > database >  Apps script: Missing rows in output
Apps script: Missing rows in output

Time:09-11

I'm learning how to query the YouTube API with apps script by following this enter image description here

CodePudding user response:

Try changing:

var rowStart = (i*50) 2

To:

var rowStart = activeSheet.getLastRow() 1

Result: enter image description here

Explanation:

For the rowStart you are multiplying the index by 50 but some results being returned for the items in your array are not exactly 50, therefore causing these blank rows. So changing this to getLastRow() will make it work to whatever the size of your array will be.

MOB PSYCHO 101 = 48 items enter image description here

VINLAND SAGA = 46 items enter image description here

Total = 243 items enter image description here You'll have 7 blank rows if you multiply by 50

  • Related