title: Understand the Range while adding text in Google Doc using Google API in PHP
body: <p>I want to add text on Google Doc but confused with &quot;range&quot; parameter. I want to understand the role of &quot;range&quot; parameter while adding text to any Google Doc. I will be adding text always on top of the doc only, so please guide me where I am doing wrong. Additionally I will be adding checkboxes as well against some text too. Following is the code which I am using currently to add text and then add checkbox:</p>
  <pre><code>$requests[] = new \Google_Service_Docs_Request(
          array(
              'insertText' =&gt; array(
                  'text' =&gt; 'abcdtrig',
                  'location' =&gt; array(
                      'index' =&gt; 10),
              ),
          )
      );
  
      $requests[] = new \Google_Service_Docs_Request(
          array(
              'createParagraphBullets' =&gt; array(
                  'range' =&gt; array(
                      'startIndex' =&gt; 1,
                      'endIndex' =&gt; 25
                  ),
                  'bulletPreset' =&gt; 'BULLET_CHECKBOX'
              ),
          )
      );
  
      $requests[] = new \Google_Service_Docs_Request(
          array(
              'deleteParagraphBullets' =&gt; array(
                  'range' =&gt; array(
                      'startIndex' =&gt; 1,
                      'endIndex' =&gt; 2
                  )
              ),
          )
      );
  
      $requests[] = new \Google_Service_Docs_Request(
          array(
              'insertText' =&gt; array(
                  'text' =&gt; '#milk',
                  'location' =&gt; array(
                      'index' =&gt; 1),
              ),
          )
      );
  
  
      $batchUpdateRequest = new \Google_Service_Docs_BatchUpdateDocumentRequest(array(
          'requests' =&gt; $requests
      ));
  </code></pre>
  <p>I want it to work in a way that whenever I run this script it should add text on top of the doc and existing content of the doc will shift down.</p>
  <p>Please help me to understand the concept of range because other things are working fine and I am clear on that. Just need to understand the &quot;range&quot; concept only.</p>