title: Use Deepl API and google sheets
body: <p>I'm working on a script to translate a text included in a google sheets cell with the deepl api. My code works and generates a result, but it does not recognise the text included in the cell.</p>
  <p>This is the code I am using:</p>
  <pre><code>function deeplapi() {
    var response = UrlFetchApp.fetch(&quot;https://api.deepl.com/v2/translate?auth_key=xxxx-xxxx-xxxx-xxxx-xxxx&amp;text=&quot;+ text +&quot;&amp;target_lang=en&amp;source_lang=es&quot;);
  
    var ss = SpreadsheetApp.getActiveSpreadsheet();
    var sheet = ss.getActiveSheet();
  
    var text = sheet.getRange(3,2).getValue();
  
  var json = response.getContentText(); 
  
  var data = JSON.parse(json); 
  Logger.log(data);
  }
  </code></pre>
  <p>Although it generates a response, the text entered appears as &quot;undefined&quot;.I don't know why this is happening.</p>
  <p>Here is the image of my sheet and the result of the script.</p>
  <p>The result is this. As you can see, the text appears as undefined:</p>
  <p><em>Información    {translations=[{text=undefined, detected_source_language=ES}]}</em></p>
  <p><img src="https://i.stack.imgur.com/CyceG.png" alt="sheet" /></p>