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

132
Views
Google sheet cell is only writen once instead of multiple times

I would like to make a visual random number genarator. That means in Cell F4 should random numbers shuffle trough until it stops with a random number. My Problem is now, that i can only see the last number generated and not the shuffeling.

function Wuerfeln() {

  var Upperbound = 60;
  var Lowerbound = 1;
  var i = Math.floor(Math.random() * (50 - 10 + 1) + 10);
  var RandomNummber = 0;
  var range = SpreadsheetApp.getActiveSpreadsheet().getRange("F4");

  while(i>0)
  {
    RandomNummber = Math.floor(Math.random() * (Upperbound - Lowerbound + 1) + Lowerbound);
    range.setValue(RandomNummber);
    i--;
    Utilities.sleep(200);
  };
};

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

0

I would suggest you define a few things and then try it out until it looks like you want, or what you could do is create a pop up which shows a .gif of a dice.

The first approach would look like this

function wurfel(){
   const timeDelay = 200
   const numbersToShowUntilFinal = 20 // or do a random num

   // then your code here, 
   // but using the variables above to test around until you found a cool 

}

about 4 years ago · Juan Pablo Isaza Report

0

Google Sheets has a minimum refresh time, you're not going to make it change super fast by design.

Many requests from a script get batched together and run at the same time, so when the edits are all in the same cell you do not see them change and only the last one is displayed.

The only way to force a cell to change is using SpreadsheetApp.flush() as suggested by Sergey. This forces all pending sheet changes to be pushed. As you have noted however, this is slow.

To do this at all you would need to have an HTML dialog or sidebar which can run JavaScript that directly changes the HTML elements rather than a cell in the spreadsheet.

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!