title: Add calculated data from userform
body: <p>I have a working userform ui in google spreadsheet that works just fine. It adds 1 row of data I enter in userform. But I need to add more rows with changed data.</p>
  <p>For example the second row added, I need this div id &quot;incomeeur&quot; to be multiplied by a percentage number that is located in sheet2 of the same spreadsheet file in the H6 cell.
  The third row added, &quot;incomeeur&quot; multiplied by a different percentage number in sheet2 H7 cell.
  <a href="https://i.stack.imgur.com/mjf0S.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mjf0S.png" alt="example of 2 additinal rows" /></a></p>
  <p>But I don't know how to take the value from this &quot;incomeeur&quot; and multiply it by the cell in sheet2.
  I tried to do something like this, but it never worked, so I just deleted that from the code.</p>
  <pre><code>  const ws = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('sheet2');
    const incomeeur3 = ws.getRange('H6').getValue();
    const incomeeur2 = document.getElementById(&quot;incomeeur&quot;).getValue();
    const incomeeur4 = incomeeur2 * incomeeur3;
  </code></pre>
  <p>Can anyone help? :)</p>
  <p>So far I have 2 files:</p>
  <ol>
  <li><p>HTML</p>
  <pre class="lang-html prettyprint-override"><code>&lt;!doctype html&gt;
  &lt;html lang=&quot;en&quot;&gt;
  
  &lt;body&gt;
  
  &lt;div class=&quot;container&quot;&gt;
  &lt;div&gt;
  &lt;div class=&quot;form-group&quot;&gt;
  &lt;label for=&quot;docnumber&quot;&gt;№ doc&lt;/label&gt;
  &lt;input type=&quot;text&quot; class=&quot;form-control&quot; id=&quot;docnumber&quot; 
  placeholder=&quot;Вул./місто/клієнт/виріб&quot;&gt;
  &lt;/div&gt;
  
  &lt;div class=&quot;form-group&quot;&gt;
  &lt;label for=&quot;whereandhow&quot;&gt;sender&lt;/label&gt;
  &lt;select class=&quot;form-control&quot; id=&quot;whereandhow&quot;&gt;
  &lt;/select&gt;
  &lt;/div&gt;
  
  &lt;div class=&quot;form-group&quot;&gt;
  &lt;label for=&quot;comment&quot;&gt;comment&lt;/label&gt;
  &lt;input type=&quot;text&quot; class=&quot;form-control&quot; id=&quot;comment&quot; placeholder=&quot;Введіть примітку&quot;&gt;
  &lt;/div&gt;
  &lt;div class=&quot;form-group&quot;&gt;
  &lt;label for=&quot;incomeeur&quot;&gt;income, €&lt;/label&gt;
  &lt;input type=&quot;text&quot; class=&quot;form-control&quot; id=&quot;incomeeur&quot; placeholder=&quot;Cума, €&quot;&gt;
  &lt;/div&gt;
  
  &lt;button class=&quot;btn btn-primary btn-lg btn-block&quot; id=&quot;mainButton&quot;&gt;Додати&lt;/button&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  
  &lt;script&gt;
  
    function afterButtonClicked(){
    var docnumber1 = document.getElementById(&quot;docnumber&quot;);
    var whereandhow1 = document.getElementById(&quot;whereandhow&quot;);
    var comment1 = document.getElementById(&quot;comment&quot;);
    var incomeeur1 = document.getElementById(&quot;incomeeur&quot;);
    var incomeusd1 = document.getElementById(&quot;incomeusd&quot;);
    var incomeuah1 = document.getElementById(&quot;incomeuah&quot;);
    var eurrate1 = document.getElementById(&quot;eurrate&quot;);
    var usdrate1 = document.getElementById(&quot;usdrate&quot;);
    var expenseeur1 = document.getElementById(&quot;expenseeur&quot;);
    var expenseusd1 = document.getElementById(&quot;expenseusd&quot;);
    var expenseuah1 = document.getElementById(&quot;expenseuah&quot;);
    var expensetype1 = document.getElementById(&quot;expensetype&quot;);
  
    var rowData = {docnumber1: docnumber1.value,whereandhow1: whereandhow1.value,comment1: comment1.value,incomeeur4: incomeeur4.value,incomeusd1: incomeusd1.value,incomeuah1: incomeuah1.value,eurrate1: eurrate1.value,usdrate1: usdrate1.value,expenseeur1: expenseeur1.value,expenseusd1: expenseusd1.value,expenseuah1: expenseuah1.value,expensetype1: expensetype1.value};
  google.script.run.withSuccessHandler(afterSubmit).addNewRow(rowData)
    }
  
   &lt;/script&gt;
   &lt;/body&gt;
   &lt;/html&gt;
  </code></pre>
  </li>
  <li><p>Then in gs file, I run function for data entry into the spreadsheet</p>
  </li>
  </ol>
  <pre class="lang-js prettyprint-override"><code>function addNewRow(rowData) {
  
      const currentDate = Utilities.formatDate(new Date(), &quot;GMT+2&quot;, &quot;dd.MM.yy&quot;);
      
      const ss = SpreadsheetApp.getActiveSpreadsheet();
      const ws = ss.getSheetByName('sheet1');
      ws.appendRow([currentDate,rowData.docnumber1,rowData.whereandhow1,rowData.comment1,rowData.incomeeur4,rowData.incomeusd1,rowData.incomeuah1,rowData.eurrate1,rowData.usdrate1,rowData.expenseeur1,rowData.expenseusd1,rowData.expenseuah1,rowData.expensetype1]);
  
  return true;
  
  }
  </code></pre>
  <p>all credits go to this youtube video <a href="https://www.youtube.com/watch?v=VzUDw7O8yhE&amp;list=PLv9Pf9aNgemuzTNWeHd8HziGVNzSlWACh&amp;index=2" rel="nofollow noreferrer">https://www.youtube.com/watch?v=VzUDw7O8yhE&amp;list=PLv9Pf9aNgemuzTNWeHd8HziGVNzSlWACh&amp;index=2</a></p>