Advertisement
rmalcoriza

recalculateSheet

Jun 21st, 2018
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. function recalculateSheet() {
  2.  
  3. // The code below opens a spreadsheet using its ID
  4. // Note that the spreadsheet is NOT physically opened on the client side.
  5. // It is opened on the server only (for modification by the script).
  6. var ss = SpreadsheetApp.getActiveSpreadsheet();
  7. var sheet = ss.getActiveSheet();
  8. var timeCell = sheet.getRange('F1');
  9. var lastRow = sheet.getLastRow();
  10. var cell = sheet.getRange('C2:C');
  11.  
  12. var cellFormula2;
  13.  
  14. var now = new Date();
  15.  
  16.  
  17. timeCell.setValue(now + " " + now.getHours() + ":" + now.getMinutes());
  18. cell.clearContent();
  19. SpreadsheetApp.flush();
  20. Utilities.sleep(2000);
  21. for(i=2;i<=lastRow;i++){
  22. cellFormula2 = sheet.getRange('C'+[i]);
  23. cellFormula2.setValue('=importJSON(B'+[i]+',"/sections/products/cheapest/productUrl","noHeaders")');
  24. }
  25.  
  26.  
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement