Use Google Docs equation editor. Delete any code in the script editor. Learn how to insert equations into a Google document.
Click the cell you want to.
Enter the below formula to D2. Type an equal sign in a cell and type in the function you want to use. Enter the below formula to D2. Enter the formula.