title: Evaluate a string to a formula in Google Sheets
body: <p>I am writing a math paper where i would like to display my calculations (formulas) separately from the solution.</p>
  <p>I am currently working in Google Sheets.</p>
  <p><strong>The end goal would be to have one column with formulas and one column with answers.</strong></p>
  <p>I tried to work with GS to write a function that would take the string value from A1 and evaluate it in the B1 column.</p>
  <p>I used this simple script that i found on:
  <a href="https://support.google.com/docs/thread/13826624/evaluate-string-as-formula?hl=en" rel="nofollow noreferrer">https://support.google.com/docs/thread/13826624/evaluate-string-as-formula?hl=en</a></p>
  <pre><code>function run(input){
    return eval(input);
  }
  </code></pre>
  <p>It works with simple calculations like division, multiplication, addition and subtraction.</p>
  <p>But the script doesn't solve basic exponents like <code>1 * 10^3</code> (it gives me 9). And square roots like <code>sqrt(9)</code> (gives me an #error)</p>
  <p>I'm not sure which way to go from here.</p>