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 8990841
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T22:35:30+00:00 2026-06-15T22:35:30+00:00

I have a custom function that looks up the current number of likes for

  • 0

I have a custom function that looks up the current number of likes for a specific facebook page. I also have a custom function, set to run once a day by a trigger,that is supposed to copy and paste the cells containing the facebook query function. This will allow me to have in two columns 1) date and 2) number of likes, updating for each new day. I have to copy and paste values before the day is out so that the number of likes for each day does not automatically recalculate to the current number of likes.

The problem I am having is between the copying and pasting of the formula and copying and pasting of the values. It appears the formula is not loading fast enough as I keep on pasting the value “thinking…”. I have tried the Utilities.Sleep() function to pause the script before copy and pasting values but it does not appear to solve the problem. Both custom functions are below. Any advice?

function FBlikes(url) {
  var jsondata = UrlFetchApp.fetch("https://graph.facebook.com/"+url); 
  var object = Utilities.jsonParse(jsondata.getContentText());  
  return object.likes; //returns the number of "likes"
}


//pastes FB likes
function updateFbLikes() {
  var s = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Like History");
  var rangeToCopy = s.getRange("A2:E2"); //sets second line as the range to be copied
  var range = s.setActiveCell("A331");
  var notLastRow = true;
  while(notLastRow){  //finds last row
    if(range.getRow() == s.getLastRow()){
      notLastRow = false;
      s.insertRowAfter(s.getLastRow());
    }
    range = range.offset(1, 0);    
  }
  rangeToCopy.copyTo(range); // Paste the data
  range = range.offset(0, 0, 1, 5); //grab the whole new pasted row
  Utilities.sleep(10000); //slowdown so data will load before pasting values 
  range.copyValuesToRange(s, range.getColumn(), range.getColumn()+4, range.getRow(), range.getRow());   //paste values
}
  • 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-15T22:35:31+00:00Added an answer on June 15, 2026 at 10:35 pm

    If I understand correctly and what you are trying to do is take the results from row 2 and place them at the end of the page as static values.

    If so you might try:

    1. Delete all unused rows from the bottom of the sheet
    2. Use the following code
    function updateFbLikes() {
      var s = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Like History");
      var valuesToCopy = s.getRange("A2:E2").getValues();
      s.appendRow(valuesToCopy[0]);
    }
    

    If there is more to it please let me know.

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

Sidebar

Related Questions

I have a function that I set custom key and value to it and
I have a custom logging function to log to the firebug console that looks
I have a custom class that looks like: function myClass(){ var thing; var thingtype;
Ok so say I have a function that looks for a specific word in
I have a function that I use as a callback for a custom event:
I have a script in Filemaker that calls a Brian Dunning hosted custom function
I originally made a custom function for timing functions that looks like this: def
I have an archive page that shows custom posts, each of which has a
I have a custom class that looks like this: qx.Class.define('test.Table2', { extend: qx.ui.table.Table, construct:
I have created a custom function and I am getting this error. I dont

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.