Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

183
Views
Parse and count total sum of numbers - Google Apps Script

I am exporting items to Google sheet. Item values include dot instead of comma, so I probably need to parse them first before I can count the total sum? What would be the best way to do this using Google Apps Script? I need to automate this process so I cannot use Google Sheets built in functions.

enter image description here

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Try this:

function myfunk1() {
  const ss = SpreadsheetApp.getActive();
  const sh = ss.getSheetByName('Your sheet name');
  const sum = sh.getRange(2,2,sh.getLastRow() -2,1).getDisplayValues().reduce((a,c)=>{ a+=parseFloat(c);return a;},0);
  sh.getRange(2,1,sh.getLastRow() - 1).getValues().forEach((r,i) => {if(r[0]=='sum')sh.getRange(i + 2,2).setValue(Number(sum).toFixed(2))});
} 

Ouput:

Item Cost
1 57.9
2 111.9
3 39.9
sum 209.7
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!