Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8770145
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T17:30:20+00:00 2026-06-13T17:30:20+00:00

I am creating a spreadsheet using JavaScript and cannot figure out how to valuate

  • 0

I am creating a spreadsheet using JavaScript and cannot figure out how to valuate the =SUM field. My code will produce an array ex (=SUM,A1,B1) but I am lost on how to change the attribute of A1 and B1 to grab the value of their associated fields.

function saveCell()
{
// get the text the user just typed into the text box
var cellText = document.getElementById("txtCell").value;

var tokenArray = getFormula(cellText);

// if null... this isn't a formula
if (tokenArray != null)
{
    alert("This is a formula to sum from " + tokenArray[1] + " to " + tokenArray[2]);

}
else
    currentRef.innerHTML = cellText;

    ssArray[currentRow - 1][currentCol - 1] = cellText;
}//end saveCell()


// determines if user entered a formula such as =SUM(A1:B1)
// returns an array with cell coordinates

function getFormula(tbValue)
{

// this is a regular expression pattern which is intended to
// split the string (formula) on any of ":" "(" or ")"
var pattern = /[:|\(|\)]/;

// do the split ... ar is an array
var ar = tbValue.split(pattern);

// convert =sum to upper case
var sum = ar[0].toUpperCase();
var attOne = ar[1];
var attTwo = ar[2];

if (ar.length < 3)
    return null;
else if (sum != "=SUM")
    return alert("The function '"+sum+"' is not supported...");
else
{
    //return an array of strings
    return ar;
    }
}//end getFormula()
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T17:30:21+00:00Added an answer on June 13, 2026 at 5:30 pm

    Hmm If I understand well, A1, and B1 should be de “id” of the elements in where the values are stored, so you should get inside those elements and obtain the values.

    In such case, you can use document.getelementbyid(attOne).value to obtain the value inside the A1 field;

    Although I’m a bit lost by your question, may be you should post the structure of the spreadsheet.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The tutorial is here: Tutorial: Writing Spreadsheet data using JavaScript Objects The full code
Quite embarrassing really, but I tested creating a database from a spreadsheet with a
I am using Spreadsheet for ruby for creating excel files. Now I want that
Our workbooks are server-generated SpreadsheetML , which cannot include any VBA code. Creating native
I have a uiApp that is creating table views from spreadsheet data, but I'm
When creating a chart in a spreadsheet using Spreadsheet::WriteExcel , the file it creates
What column names cannot be used when creating an Excel spreadsheet with ADO. I
I'm creating some client side functions for a mappable spreadsheet export feature. I'm using
This is probably very simple: I'm creating a workbook (i.e. spreadsheet) using the Spreadsheet
I'm creating excel spreadsheets for reports using the XML method, where you export a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.