title: google sheet API, Deleting row
body: <p>so i am trying to do a simple task which is deleting rows in my google sheet. surprisingly, it isn't work like I expected.
  so from the code below, you could see I am entering all the row number i would like to delete &amp; i wrote down console log to make sure these are the rows I want them to be deleted</p>
  <pre><code> for(let i = 0; i &lt; deletion.length; i++)
   {
              console.log(&quot;deleteing &quot; + rowCharacter[deletion[i]].Discord)
              await rowCharacter[deletion[i]].delete()
              console.log(&quot;deleteing &quot; + rowCharacter[deletion[i]].Discord)    
   }
  </code></pre>
  <p>Some of the rows end up deleted. Some will not.
  Any suggestions will be much appreciated or even one command that could clear everything without doing a loop? I will share the entirety of the method below:</p>
  <pre><code>async cleanSheet(discordtag:string[]){
          await this.memo.loadCells()
          let begin = this.memo.rowCount
          let rowCharacter = await this.character.getRows()
          let deletion:number[] = [], i = 415 , row:GoogleSpreadsheetRow[] = []
          console.log(&quot;start&quot;)
          for(let j = 0;  i &lt; rowCharacter.length; j++)
          {
              console.log(&quot;checking&quot; + rowCharacter[i].Discord)
              if(rowCharacter[i]?.Discord == undefined)
              {
                      i++
              }
              //console.log( rowCharacter[i].Discord)
              else if(discordtag[j] == rowCharacter[i].Discord)
              {
                  i++
                  j = 0
              }
              else if(j == discordtag.length)
              {
                  console.log(rowCharacter[i].Discord)
                  rowCharacter[i].Character = rowCharacter[i].Character + &quot; [retired]&quot;
                  console.log(&quot;rows to add&quot; +rowCharacter[i].Character)
  
                  row.push(rowCharacter[i])
                  //await this.memo.addRow(rowCharacter[i])
                  deletion.push(i)
                  i++
                  j = 0
              }
          }
          await this.memo.addRows(row)
          console.log(&quot;rows to delete&quot; + deletion)
          let end = deletion.length + begin
          for(let i = 0; i &lt; deletion.length; i++)
          {
              console.log(&quot;deleteing &quot; + rowCharacter[deletion[i]].Discord)
              
              await rowCharacter[deletion[i]].delete()
              console.log(&quot;deleteing &quot; + rowCharacter[deletion[i]].Discord)
  
          }
          await this.memo.loadCells()
      
          for(let i = begin; i &lt; end; i++)
              for( let j = 0; j &lt; 49; j++)
                  this.memo.getCell(i,j).borders = this.memo.getCell(1,1).borders
          
          this.memo.saveUpdatedCells()
          console.log(&quot;done&quot;)
  
      }
  </code></pre>