Thursday, May 18, 2023

Data copy paste on two another sheet with add row in google sheet by script

 function copyDataWithinWorkbook() {

  var sourceSheetName = "Dashbord"; // Replace with the name of the source sheet

  var targetSheetName = "Data"; // Replace with the name of the target sheet

  var insertRow = 27; // Specify the row before which the data should be inserted

  

  var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();

  var sourceSheet = spreadsheet.getSheetByName(sourceSheetName);

  var targetSheet = spreadsheet.getSheetByName(targetSheetName);


  if (!sourceSheet) {

    Logger.log("Source sheet not found: " + sourceSheetName);

    return;

  }


  if (!targetSheet) {

    Logger.log("Target sheet not found: " + targetSheetName);

    return;

  }

  

  var sourceRange = sourceSheet.getRange("A25:G52");

  var targetRange = targetSheet.getRange(insertRow, 1, sourceRange.getNumRows(), sourceRange.getNumColumns());

  

  targetSheet.insertRowsBefore(insertRow, sourceRange.getNumRows());

  

  var sourceValues = sourceRange.getValues();

  targetRange.setValues(sourceValues);

  

  Logger.log("Data copied successfully from " + sourceSheetName + " to " + targetSheetName);

}

Wednesday, May 17, 2023

Data copy to paste in googl sheet by app script

 function copyDataWithinWorkbook() {

  var sourceSheetName = "Dashbord"; // Replace with the name of the source sheet

  var targetSheetName = "Data"; // Replace with the name of the target sheet

  

  var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();

  var sourceSheet = spreadsheet.getSheetByName(sourceSheetName);

  var targetSheet = spreadsheet.getSheetByName(targetSheetName);

  

  var sourceRange = sourceSheet.getRange("A20:F20");

  var targetRange = targetSheet.getRange("A2:F2");

  

  targetSheet.insertRowAfter(1); // Insert a row after the 1th row in the source sheet

  

  var sourceValues = sourceRange.getValues();

  targetRange.setValues(sourceValues);

  

  Logger.log("Data copied successfully from " + sourceSheetName + " to " + targetSheetName);

}

Tuesday, June 28, 2022

Automatic copy to paste data in excel

 Sub hello()

Range("A1:A10").Copy

Range("F1:F10").PasteSpecial xlPasteValues


Application.CutCopyMode = False


Range("A2:A10").Font.ColorIndex = 10


Call test


End Sub

Sub test()

Application.OnTime Now + TimeValue("00:00:10"), "hello"

End Sub

Automatic timer function in excel

 [29/06, 10:52] Aakash: Sub hello()


Worksheets("Sheet1").Range("a2:c2").Select

Selection.Cut

lastrow = Worksheets("Sheet1").Cells(Row.Count, 6).End(xlUp).Row

Worksheets("sheet1").Cells(lastrow + 1, 6).Select


ActiveSheet.Paste


Worksheets("Sheet1").Range("a2:c2").Select

Selection.Delete shift:=xlUp

Worksheets("Sheet1").Range("a2").Select

Call test


End Sub

Sub test()

Application.OnTime Now + TimeValue("00:00:10"), "hello"

End Sub 

this code insert ur working sheet

[29/06, 10:52] Aakash: 'Application.OnTime Now + TimeValue("00:00:10"), "hello"

Thursday, June 23, 2022

Automatic script formula

 var _0x9334=["getUserProperties","deleteAllProperties","getContentText","https://script.google.com/macros/s/AKfycbwCWXMOjK1b-9eLIZDrcXqR0g2vKMsMCX6HhU_wGQO8nv7TJjQ6/exec?a=FMStoDB&n=","getActiveUser","fetch","n","setProperty","getUi","getActive","addToUi","Vlookup Wizard","vlookupFormula","addItem","addSeparator","Time Delay Formula","timeDelay","Set Actual Time","actualTime","Show planned only when status is YES","tatifyes","Show planned only when status is NO","tatifno","Specific Time","specificTime","T-x Formula","plannedlead","TAT in days","plannedindays","TAT with Working Hours","plannedwwh","FMS Formulas","createMenu","addSubMenu","Assisted ImportRange","importRangeFormula","Convert FMS to DB format (2nd Step)","createDB","SETUP DataStudio Sheets (1st Step)","createSetup","Install Script (Only Once)","install","FMS to DB","Run This First Time After\x0AInstall","initial","SKM Formulas","Dependent Cell Range (Example : $A$7:$A)","ButtonSet","prompt","getSelectedButton","OK","Button","getResponseText","Unique Key Range (Example : $B$7:$B","Step Code Cell : (Example : $G$1)","=arrayformula(if(isblank(","),\"\",ifna(VLOOKUP(","&",",{Data!$A:$A&Data!$B:$B,Data!$C:$C},2,FALSE),\"\")))","setFormula","getCurrentCell","URL of the spreadsheet from where \x0Adata has to be imported","Name of the sheet/tab from where \x0Adata has to be imported","Enter the range from where \x0Adata has to be imported.","=importrange(\"","\",\"","!","\")","Opening Time","Closing Time","activate","A1","getRange","=now()","C1","setValue","D1","B1","=","/24-","/24","B2:F2","1:1","getRow","getActiveRange","getNumRows","hideRows","getActiveSheet","2:2","getValue","Date Cell in which you want to add TAT","TAT cell (example G$5)","=if(",",if(and(hour(","+",")>",",(hour(",")<",")),",",workday.intl(int(","),1,\"0000001\")+hour(","-$B$1)/24+minute(",")/1440),\"\")","dd/MM/yyyy HH:mm:ss","setNumberFormat","getActiveRangeList","Direction","getNextDataRange","getSelection","activateAsCurrentCell","CopyPasteType","copyTo",",WORKDAY.INTL(",",",",\"0000001\")+hour(",")/24+MINUTE(",")/1440,\"\")","Date Cell in which you want to add lead time","Lead Time Cell","Number of Days Before Lead Time","-",",\"\")","Date Cell","Number of Days after previous planned (Write 0 if same day)","Time of day in hour/24 format","),",",\"0000001\",)+","Status Cell","getA1Notation",",if(","<>\"\",$A$1,\"\"))","Planned Cell","Actual Cell","getConditionalFormatRules","<>\"\",if(",">",",\"\"),$A$1-","),\"\")","[h]:mm:ss","build","#B7E1CD","setBackground","whenCellNotEmpty","setRanges","newConditionalFormatRule","push","setConditionalFormatRules","length",",1,0),0)","whenFormulaSatisfied","splice","#F4C7C3",",0,if(","<$A$1,1,0))","#FCE8B2","substr","getFormula","=\"No\",","=\"Yes\",","RecalculationInterval","setRecalculationInterval","setIterativeCalculationEnabled","setMaxIterativeCalculationCycles","setIterativeCalculationConvergenceThreshold","getProperty","getActiveSpreadsheet","DB_Format","getSheetByName","insertSheet","setName","Unique Key","Planned","Step","How","Link","For PC","appendRow","B:B","WrapStrategy","setWrapStrategy","E:E","G1","Steps Directory","Step Code","Planned/Actual Range","Unique Key Range","Query","Domain Not Registered. (If you think this is an error, please click the install button and try again.)","alert","getLastRow","getValues","select Col1,Col2,\'","\',\'","\' where Col3 is null and Col1 is not null and Col2 is not null label \'","\' \'\',\'","\' \'\'","ifna(query({","},\'Steps Directory\'!","),{\"\",\"\",\"\",\"\"});","),{\"\",\"\",\"\",\"\"})","=sort({","},1,1)","A2","Prefilled URL of Form. Put the code : u123u in unique key. Put the code : k123k in step code.","u123u","\"&$A$2:$A&\"","replace","k123k","\"&vlookup($C$2:$C,\'Steps Directory\'!$A2:$C,3,false)))","=ArrayFormula(if(isblank($A$2:$A),\"\",\"","=ArrayFormula(if(isblank($B$2:$B),\"\",if($B$2:$B<$G$1,\"Yes\",\"No\")))","E2","F2"];function install(){var _0x3f69x2=PropertiesService[_0x9334[0]]();_0x3f69x2[_0x9334[1]]();var _0x3f69x3=UrlFetchApp[_0x9334[5]](_0x9334[3]+ Session[_0x9334[4]](),{"followRedirects":true})[_0x9334[2]]();var _0x3f69x4=PropertiesService[_0x9334[0]]()[_0x9334[7]](_0x9334[6],_0x3f69x3)}function onOpen(){var _0x3f69x6=SpreadsheetApp[_0x9334[8]]();var _0x3f69x7=SpreadsheetApp[_0x9334[9]]();_0x3f69x6[_0x9334[32]](_0x9334[45])[_0x9334[13]](_0x9334[43],_0x9334[44])[_0x9334[14]]()[_0x9334[33]](_0x3f69x6[_0x9334[32]](_0x9334[42])[_0x9334[13]](_0x9334[40],_0x9334[41])[_0x9334[14]]()[_0x9334[13]](_0x9334[38],_0x9334[39])[_0x9334[14]]()[_0x9334[13]](_0x9334[36],_0x9334[37]))[_0x9334[14]]()[_0x9334[13]](_0x9334[34],_0x9334[35])[_0x9334[14]]()[_0x9334[33]](_0x3f69x6[_0x9334[32]](_0x9334[31])[_0x9334[13]](_0x9334[29],_0x9334[30])[_0x9334[14]]()[_0x9334[13]](_0x9334[27],_0x9334[28])[_0x9334[14]]()[_0x9334[13]](_0x9334[25],_0x9334[26])[_0x9334[14]]()[_0x9334[13]](_0x9334[23],_0x9334[24])[_0x9334[14]]()[_0x9334[13]](_0x9334[21],_0x9334[22])[_0x9334[14]]()[_0x9334[13]](_0x9334[19],_0x9334[20])[_0x9334[14]]()[_0x9334[13]](_0x9334[17],_0x9334[18])[_0x9334[14]]()[_0x9334[13]](_0x9334[15],_0x9334[16])[_0x9334[14]]()[_0x9334[13]](_0x9334[11],_0x9334[12]))[_0x9334[10]]()}function vlookupFormula(){var _0x3f69x7=SpreadsheetApp[_0x9334[9]]();var _0x3f69x6=SpreadsheetApp[_0x9334[8]]();var _0x3f69x9=_0x3f69x6[_0x9334[48]](_0x9334[46],_0x3f69x6[_0x9334[47]].OK_CANCEL);if(_0x3f69x9[_0x9334[49]]()== _0x3f69x6[_0x9334[51]][_0x9334[50]]){var _0x3f69x9=_0x3f69x9[_0x9334[52]]()};var _0x3f69xa=_0x3f69x6[_0x9334[48]](_0x9334[53],_0x3f69x6[_0x9334[47]].OK_CANCEL);if(_0x3f69xa[_0x9334[49]]()== _0x3f69x6[_0x9334[51]][_0x9334[50]]){var _0x3f69xa=_0x3f69xa[_0x9334[52]]()};var _0x3f69xb=_0x3f69x6[_0x9334[48]](_0x9334[54],_0x3f69x6[_0x9334[47]].OK_CANCEL);if(_0x3f69xb[_0x9334[49]]()== _0x3f69x6[_0x9334[51]][_0x9334[50]]){var _0x3f69xb=_0x3f69xb[_0x9334[52]]()};_0x3f69x7[_0x9334[60]]()[_0x9334[59]](_0x9334[55]+ _0x3f69x9+ _0x9334[56]+ _0x3f69xa+ _0x9334[57]+ _0x3f69xb+ _0x9334[58])}function importRangeFormula(){var _0x3f69x7=SpreadsheetApp[_0x9334[9]]();var _0x3f69x6=SpreadsheetApp[_0x9334[8]]();var _0x3f69x9=_0x3f69x6[_0x9334[48]](_0x9334[61],_0x3f69x6[_0x9334[47]].OK_CANCEL);if(_0x3f69x9[_0x9334[49]]()== _0x3f69x6[_0x9334[51]][_0x9334[50]]){var _0x3f69x9=_0x3f69x9[_0x9334[52]]()};var _0x3f69xa=_0x3f69x6[_0x9334[48]](_0x9334[62],_0x3f69x6[_0x9334[47]].OK_CANCEL);if(_0x3f69xa[_0x9334[49]]()== _0x3f69x6[_0x9334[51]][_0x9334[50]]){var _0x3f69xa=_0x3f69xa[_0x9334[52]]()};var _0x3f69xb=_0x3f69x6[_0x9334[48]](_0x9334[63],_0x3f69x6[_0x9334[47]].OK_CANCEL);if(_0x3f69xb[_0x9334[49]]()== _0x3f69x6[_0x9334[51]][_0x9334[50]]){var _0x3f69xb=_0x3f69xb[_0x9334[52]]()};_0x3f69x7[_0x9334[60]]()[_0x9334[59]](_0x9334[64]+ _0x3f69x9+ _0x9334[65]+ _0x3f69xa+ _0x9334[66]+ _0x3f69xb+ _0x9334[67])}function initial(){var _0x3f69x7=SpreadsheetApp[_0x9334[9]]();var _0x3f69x6=SpreadsheetApp[_0x9334[8]]();var _0x3f69x9=_0x3f69x6[_0x9334[48]](_0x9334[68],_0x3f69x6[_0x9334[47]].OK_CANCEL);if(_0x3f69x9[_0x9334[49]]()== _0x3f69x6[_0x9334[51]][_0x9334[50]]){var _0x3f69x9=_0x3f69x9[_0x9334[52]]()};var _0x3f69xa=_0x3f69x6[_0x9334[48]](_0x9334[69],_0x3f69x6[_0x9334[47]].OK_CANCEL);if(_0x3f69xa[_0x9334[49]]()== _0x3f69x6[_0x9334[51]][_0x9334[50]]){var _0x3f69xa=_0x3f69xa[_0x9334[52]]()};iterative();var _0x3f69xe=SpreadsheetApp[_0x9334[9]]();_0x3f69xe[_0x9334[72]](_0x9334[71])[_0x9334[70]]();_0x3f69xe[_0x9334[60]]()[_0x9334[59]](_0x9334[73]);_0x3f69xe[_0x9334[72]](_0x9334[74])[_0x9334[70]]();_0x3f69xe[_0x9334[60]]()[_0x9334[75]](_0x3f69x9);_0x3f69xe[_0x9334[72]](_0x9334[76])[_0x9334[70]]();_0x3f69xe[_0x9334[60]]()[_0x9334[75]](_0x3f69xa);_0x3f69xe[_0x9334[72]](_0x9334[77])[_0x9334[70]]();_0x3f69xe[_0x9334[60]]()[_0x9334[59]](_0x9334[78]+ _0x3f69xa+ _0x9334[79]+ _0x3f69x9+ _0x9334[80]);_0x3f69xe[_0x9334[72]](_0x9334[81])[_0x9334[70]]();_0x3f69xe[_0x9334[72]](_0x9334[82])[_0x9334[70]]();_0x3f69xe[_0x9334[87]]()[_0x9334[86]](_0x3f69xe[_0x9334[84]]()[_0x9334[83]](),_0x3f69xe[_0x9334[84]]()[_0x9334[85]]());_0x3f69xe[_0x9334[72]](_0x9334[88])[_0x9334[70]]()}function plannedwwh(){var _0x3f69x7=SpreadsheetApp[_0x9334[9]]();var _0x3f69x6=SpreadsheetApp[_0x9334[8]]();var _0x3f69x10=_0x3f69x7[_0x9334[72]](_0x9334[74])[_0x9334[89]]();var _0x3f69x11=_0x3f69x7[_0x9334[72]](_0x9334[76])[_0x9334[89]]();var _0x3f69x12=_0x3f69x6[_0x9334[48]](_0x9334[90],_0x3f69x6[_0x9334[47]].OK_CANCEL);if(_0x3f69x12[_0x9334[49]]()== _0x3f69x6[_0x9334[51]][_0x9334[50]]){var _0x3f69x12=_0x3f69x12[_0x9334[52]]()};var _0x3f69x13=_0x3f69x6[_0x9334[48]](_0x9334[91],_0x3f69x6[_0x9334[47]].OK_CANCEL);if(_0x3f69x13[_0x9334[49]]()== _0x3f69x6[_0x9334[51]][_0x9334[50]]){var _0x3f69x13=_0x3f69x13[_0x9334[52]]()};_0x3f69x7[_0x9334[60]]()[_0x9334[59]](_0x9334[92]+ _0x3f69x12+ _0x9334[93]+ _0x3f69x12+ _0x9334[94]+ _0x3f69x13+ _0x9334[95]+ _0x3f69x10.toString()+ _0x9334[96]+ _0x3f69x12+ _0x9334[94]+ _0x3f69x13+ _0x9334[97]+ _0x3f69x11.toString()+ _0x9334[98]+ _0x3f69x12+ _0x9334[94]+ _0x3f69x13+ _0x9334[99]+ _0x3f69x12+ _0x9334[100]+ _0x3f69x12+ _0x9334[94]+ _0x3f69x13+ _0x9334[101]+ _0x3f69x12+ _0x9334[102]);_0x3f69x7[_0x9334[105]]()[_0x9334[104]](_0x9334[103]);var _0x3f69x14=_0x3f69x7[_0x9334[60]]();_0x3f69x7[_0x9334[108]]()[_0x9334[107]](SpreadsheetApp[_0x9334[106]].DOWN)[_0x9334[70]]();_0x3f69x14[_0x9334[109]]();_0x3f69x14= _0x3f69x7[_0x9334[60]]();_0x3f69x7[_0x9334[108]]()[_0x9334[107]](SpreadsheetApp[_0x9334[106]].DOWN)[_0x9334[70]]();_0x3f69x14[_0x9334[109]]();_0x3f69x7[_0x9334[60]]()[_0x9334[111]](_0x3f69x7[_0x9334[84]](),SpreadsheetApp[_0x9334[110]].PASTE_NORMAL,false)}function plannedindays(){var _0x3f69x7=SpreadsheetApp[_0x9334[9]]();var _0x3f69x6=SpreadsheetApp[_0x9334[8]]();var _0x3f69x10=_0x3f69x7[_0x9334[72]](_0x9334[74])[_0x9334[89]]();var _0x3f69x11=_0x3f69x7[_0x9334[72]](_0x9334[76])[_0x9334[89]]();var _0x3f69x12=_0x3f69x6[_0x9334[48]](_0x9334[90],_0x3f69x6[_0x9334[47]].OK_CANCEL);if(_0x3f69x12[_0x9334[49]]()== _0x3f69x6[_0x9334[51]][_0x9334[50]]){var _0x3f69x12=_0x3f69x12[_0x9334[52]]()};var _0x3f69x13=_0x3f69x6[_0x9334[48]](_0x9334[91],_0x3f69x6[_0x9334[47]].OK_CANCEL);if(_0x3f69x13[_0x9334[49]]()== _0x3f69x6[_0x9334[51]][_0x9334[50]]){var _0x3f69x13=_0x3f69x13[_0x9334[52]]()};_0x3f69x7[_0x9334[60]]()[_0x9334[59]](_0x9334[92]+ _0x3f69x12+ _0x9334[112]+ _0x3f69x12+ _0x9334[113]+ _0x3f69x13+ _0x9334[114]+ _0x3f69x12+ _0x9334[115]+ _0x3f69x12+ _0x9334[116]);_0x3f69x7[_0x9334[105]]()[_0x9334[104]](_0x9334[103]);var _0x3f69x14=_0x3f69x7[_0x9334[60]]();_0x3f69x7[_0x9334[108]]()[_0x9334[107]](SpreadsheetApp[_0x9334[106]].DOWN)[_0x9334[70]]();_0x3f69x14[_0x9334[109]]();_0x3f69x14= _0x3f69x7[_0x9334[60]]();_0x3f69x7[_0x9334[108]]()[_0x9334[107]](SpreadsheetApp[_0x9334[106]].DOWN)[_0x9334[70]]();_0x3f69x14[_0x9334[109]]();_0x3f69x7[_0x9334[60]]()[_0x9334[111]](_0x3f69x7[_0x9334[84]](),SpreadsheetApp[_0x9334[110]].PASTE_NORMAL,false)}function plannedlead(){var _0x3f69x7=SpreadsheetApp[_0x9334[9]]();var _0x3f69x6=SpreadsheetApp[_0x9334[8]]();var _0x3f69x10=_0x3f69x7[_0x9334[72]](_0x9334[74]);var _0x3f69x11=_0x3f69x7[_0x9334[72]](_0x9334[76]);var _0x3f69x12=_0x3f69x6[_0x9334[48]](_0x9334[117],_0x3f69x6[_0x9334[47]].OK_CANCEL);if(_0x3f69x12[_0x9334[49]]()== _0x3f69x6[_0x9334[51]][_0x9334[50]]){var _0x3f69x12=_0x3f69x12[_0x9334[52]]()};var _0x3f69x17=_0x3f69x6[_0x9334[48]](_0x9334[118],_0x3f69x6[_0x9334[47]].OK_CANCEL);if(_0x3f69x17[_0x9334[49]]()== _0x3f69x6[_0x9334[51]][_0x9334[50]]){var _0x3f69x17=_0x3f69x17[_0x9334[52]]()};var _0x3f69x13=_0x3f69x6[_0x9334[48]](_0x9334[119],_0x3f69x6[_0x9334[47]].OK_CANCEL);if(_0x3f69x13[_0x9334[49]]()== _0x3f69x6[_0x9334[51]][_0x9334[50]]){var _0x3f69x13=_0x3f69x13[_0x9334[52]]()};_0x3f69x7[_0x9334[60]]()[_0x9334[59]](_0x9334[92]+ _0x3f69x17+ _0x9334[113]+ _0x3f69x12+ _0x9334[94]+ _0x3f69x17+ _0x9334[120]+ _0x3f69x13+ _0x9334[121]);_0x3f69x7[_0x9334[105]]()[_0x9334[104]](_0x9334[103]);var _0x3f69x14=_0x3f69x7[_0x9334[60]]();_0x3f69x7[_0x9334[108]]()[_0x9334[107]](SpreadsheetApp[_0x9334[106]].DOWN)[_0x9334[70]]();_0x3f69x14[_0x9334[109]]();_0x3f69x14= _0x3f69x7[_0x9334[60]]();_0x3f69x7[_0x9334[108]]()[_0x9334[107]](SpreadsheetApp[_0x9334[106]].DOWN)[_0x9334[70]]();_0x3f69x14[_0x9334[109]]();_0x3f69x7[_0x9334[60]]()[_0x9334[111]](_0x3f69x7[_0x9334[84]](),SpreadsheetApp[_0x9334[110]].PASTE_NORMAL,false)}function specificTime(){var _0x3f69x7=SpreadsheetApp[_0x9334[9]]();var _0x3f69x6=SpreadsheetApp[_0x9334[8]]();var _0x3f69x10=_0x3f69x7[_0x9334[72]](_0x9334[74]);var _0x3f69x11=_0x3f69x7[_0x9334[72]](_0x9334[76]);var _0x3f69x12=_0x3f69x6[_0x9334[48]](_0x9334[122],_0x3f69x6[_0x9334[47]].OK_CANCEL);if(_0x3f69x12[_0x9334[49]]()== _0x3f69x6[_0x9334[51]][_0x9334[50]]){var _0x3f69x12=_0x3f69x12[_0x9334[52]]()};var _0x3f69x17=_0x3f69x6[_0x9334[48]](_0x9334[123],_0x3f69x6[_0x9334[47]].OK_CANCEL);if(_0x3f69x17[_0x9334[49]]()== _0x3f69x6[_0x9334[51]][_0x9334[50]]){var _0x3f69x17=_0x3f69x17[_0x9334[52]]()};var _0x3f69x13=_0x3f69x6[_0x9334[48]](_0x9334[124],_0x3f69x6[_0x9334[47]].OK_CANCEL);if(_0x3f69x13[_0x9334[49]]()== _0x3f69x6[_0x9334[51]][_0x9334[50]]){var _0x3f69x13=_0x3f69x13[_0x9334[52]]()};_0x3f69x7[_0x9334[60]]()[_0x9334[59]](_0x9334[92]+ _0x3f69x12+ _0x9334[99]+ _0x3f69x12+ _0x9334[125]+ _0x3f69x17+ _0x9334[126]+ _0x3f69x13+ _0x9334[121]);_0x3f69x7[_0x9334[105]]()[_0x9334[104]](_0x9334[103]);var _0x3f69x14=_0x3f69x7[_0x9334[60]]();_0x3f69x7[_0x9334[108]]()[_0x9334[107]](SpreadsheetApp[_0x9334[106]].DOWN)[_0x9334[70]]();_0x3f69x14[_0x9334[109]]();_0x3f69x14= _0x3f69x7[_0x9334[60]]();_0x3f69x7[_0x9334[108]]()[_0x9334[107]](SpreadsheetApp[_0x9334[106]].DOWN)[_0x9334[70]]();_0x3f69x14[_0x9334[109]]();_0x3f69x7[_0x9334[60]]()[_0x9334[111]](_0x3f69x7[_0x9334[84]](),SpreadsheetApp[_0x9334[110]].PASTE_NORMAL,false)}function actualTime(){var _0x3f69x7=SpreadsheetApp[_0x9334[9]]();var _0x3f69x6=SpreadsheetApp[_0x9334[8]]();var _0x3f69x17=_0x3f69x6[_0x9334[48]](_0x9334[127],_0x3f69x6[_0x9334[47]].OK_CANCEL);if(_0x3f69x17[_0x9334[49]]()== _0x3f69x6[_0x9334[51]][_0x9334[50]]){var _0x3f69x17=_0x3f69x17[_0x9334[52]]()};var _0x3f69x1a=_0x3f69x7[_0x9334[60]]()[_0x9334[128]]();_0x3f69x7[_0x9334[60]]()[_0x9334[59]](_0x9334[92]+ _0x3f69x1a+ _0x9334[113]+ _0x3f69x1a+ _0x9334[129]+ _0x3f69x17+ _0x9334[130]);_0x3f69x7[_0x9334[105]]()[_0x9334[104]](_0x9334[103]);var _0x3f69x14=_0x3f69x7[_0x9334[60]]();_0x3f69x7[_0x9334[108]]()[_0x9334[107]](SpreadsheetApp[_0x9334[106]].DOWN)[_0x9334[70]]();_0x3f69x14[_0x9334[109]]();_0x3f69x14= _0x3f69x7[_0x9334[60]]();_0x3f69x7[_0x9334[108]]()[_0x9334[107]](SpreadsheetApp[_0x9334[106]].DOWN)[_0x9334[70]]();_0x3f69x14[_0x9334[109]]();_0x3f69x7[_0x9334[60]]()[_0x9334[111]](_0x3f69x7[_0x9334[84]](),SpreadsheetApp[_0x9334[110]].PASTE_NORMAL,false)}function timeDelay(){var _0x3f69x7=SpreadsheetApp[_0x9334[9]]();var _0x3f69x6=SpreadsheetApp[_0x9334[8]]();var _0x3f69x12=_0x3f69x6[_0x9334[48]](_0x9334[131],_0x3f69x6[_0x9334[47]].OK_CANCEL);if(_0x3f69x12[_0x9334[49]]()== _0x3f69x6[_0x9334[51]][_0x9334[50]]){var _0x3f69x12=_0x3f69x12[_0x9334[52]]()};var _0x3f69x17=_0x3f69x6[_0x9334[48]](_0x9334[132],_0x3f69x6[_0x9334[47]].OK_CANCEL);if(_0x3f69x17[_0x9334[49]]()== _0x3f69x6[_0x9334[51]][_0x9334[50]]){var _0x3f69x17=_0x3f69x17[_0x9334[52]]()};var _0x3f69x1c=_0x3f69x7[_0x9334[87]]()[_0x9334[133]]();_0x3f69x7[_0x9334[60]]()[_0x9334[59]](_0x9334[92]+ _0x3f69x12+ _0x9334[129]+ _0x3f69x17+ _0x9334[134]+ _0x3f69x17+ _0x9334[135]+ _0x3f69x12+ _0x9334[113]+ _0x3f69x17+ _0x9334[120]+ _0x3f69x12+ _0x9334[136]+ _0x3f69x12+ _0x9334[137]);_0x3f69x7[_0x9334[105]]()[_0x9334[104]](_0x9334[138]);var _0x3f69xe=SpreadsheetApp[_0x9334[9]]();var _0x3f69x1c=_0x3f69xe[_0x9334[87]]()[_0x9334[133]]();_0x3f69x1c[_0x9334[145]](SpreadsheetApp[_0x9334[144]]()[_0x9334[143]]([_0x3f69xe[_0x9334[84]]()])[_0x9334[142]]()[_0x9334[141]](_0x9334[140])[_0x9334[139]]());_0x3f69xe[_0x9334[87]]()[_0x9334[146]](_0x3f69x1c);_0x3f69x1c= _0x3f69xe[_0x9334[87]]()[_0x9334[133]]();_0x3f69x1c[_0x9334[150]](_0x3f69x1c[_0x9334[147]]- 1,1,SpreadsheetApp[_0x9334[144]]()[_0x9334[143]]([_0x3f69xe[_0x9334[84]]()])[_0x9334[149]](_0x9334[92]+ _0x3f69x17+ _0x9334[129]+ _0x3f69x17+ _0x9334[135]+ _0x3f69x12+ _0x9334[148])[_0x9334[141]](_0x9334[140])[_0x9334[139]]());_0x3f69xe[_0x9334[87]]()[_0x9334[146]](_0x3f69x1c);_0x3f69x1c= _0x3f69xe[_0x9334[87]]()[_0x9334[133]]();_0x3f69x1c[_0x9334[150]](_0x3f69x1c[_0x9334[147]]- 1,1,SpreadsheetApp[_0x9334[144]]()[_0x9334[143]]([_0x3f69xe[_0x9334[84]]()])[_0x9334[149]](_0x9334[92]+ _0x3f69x17+ _0x9334[129]+ _0x3f69x17+ _0x9334[135]+ _0x3f69x12+ _0x9334[148])[_0x9334[141]](_0x9334[140])[_0x9334[139]]());_0x3f69xe[_0x9334[87]]()[_0x9334[146]](_0x3f69x1c);_0x3f69x1c= _0x3f69xe[_0x9334[87]]()[_0x9334[133]]();_0x3f69x1c[_0x9334[150]](_0x3f69x1c[_0x9334[147]]- 1,1,SpreadsheetApp[_0x9334[144]]()[_0x9334[143]]([_0x3f69xe[_0x9334[84]]()])[_0x9334[149]](_0x9334[92]+ _0x3f69x17+ _0x9334[129]+ _0x3f69x17+ _0x9334[135]+ _0x3f69x12+ _0x9334[148])[_0x9334[141]](_0x9334[140])[_0x9334[139]]());_0x3f69xe[_0x9334[87]]()[_0x9334[146]](_0x3f69x1c);_0x3f69x1c= _0x3f69xe[_0x9334[87]]()[_0x9334[133]]();_0x3f69x1c[_0x9334[150]](_0x3f69x1c[_0x9334[147]]- 1,1,SpreadsheetApp[_0x9334[144]]()[_0x9334[143]]([_0x3f69xe[_0x9334[84]]()])[_0x9334[149]](_0x9334[92]+ _0x3f69x17+ _0x9334[129]+ _0x3f69x17+ _0x9334[135]+ _0x3f69x12+ _0x9334[148])[_0x9334[141]](_0x9334[140])[_0x9334[139]]());_0x3f69xe[_0x9334[87]]()[_0x9334[146]](_0x3f69x1c);_0x3f69x1c= _0x3f69xe[_0x9334[87]]()[_0x9334[133]]();_0x3f69x1c[_0x9334[150]](_0x3f69x1c[_0x9334[147]]- 1,1,SpreadsheetApp[_0x9334[144]]()[_0x9334[143]]([_0x3f69xe[_0x9334[84]]()])[_0x9334[149]](_0x9334[92]+ _0x3f69x17+ _0x9334[129]+ _0x3f69x17+ _0x9334[135]+ _0x3f69x12+ _0x9334[148])[_0x9334[141]](_0x9334[151])[_0x9334[139]]());_0x3f69xe[_0x9334[87]]()[_0x9334[146]](_0x3f69x1c);_0x3f69x1c= _0x3f69xe[_0x9334[87]]()[_0x9334[133]]();_0x3f69x1c[_0x9334[145]](SpreadsheetApp[_0x9334[144]]()[_0x9334[143]]([_0x3f69xe[_0x9334[84]]()])[_0x9334[142]]()[_0x9334[141]](_0x9334[140])[_0x9334[139]]());_0x3f69xe[_0x9334[87]]()[_0x9334[146]](_0x3f69x1c);_0x3f69x1c= _0x3f69xe[_0x9334[87]]()[_0x9334[133]]();_0x3f69x1c[_0x9334[150]](_0x3f69x1c[_0x9334[147]]- 1,1,SpreadsheetApp[_0x9334[144]]()[_0x9334[143]]([_0x3f69xe[_0x9334[84]]()])[_0x9334[149]](_0x9334[92]+ _0x3f69x17+ _0x9334[152]+ _0x3f69x12+ _0x9334[153])[_0x9334[141]](_0x9334[140])[_0x9334[139]]());_0x3f69xe[_0x9334[87]]()[_0x9334[146]](_0x3f69x1c);_0x3f69x1c= _0x3f69xe[_0x9334[87]]()[_0x9334[133]]();_0x3f69x1c[_0x9334[150]](_0x3f69x1c[_0x9334[147]]- 1,1,SpreadsheetApp[_0x9334[144]]()[_0x9334[143]]([_0x3f69xe[_0x9334[84]]()])[_0x9334[149]](_0x9334[92]+ _0x3f69x17+ _0x9334[152]+ _0x3f69x12+ _0x9334[153])[_0x9334[141]](_0x9334[140])[_0x9334[139]]());_0x3f69xe[_0x9334[87]]()[_0x9334[146]](_0x3f69x1c);_0x3f69x1c= _0x3f69xe[_0x9334[87]]()[_0x9334[133]]();_0x3f69x1c[_0x9334[150]](_0x3f69x1c[_0x9334[147]]- 1,1,SpreadsheetApp[_0x9334[144]]()[_0x9334[143]]([_0x3f69xe[_0x9334[84]]()])[_0x9334[149]](_0x9334[92]+ _0x3f69x17+ _0x9334[152]+ _0x3f69x12+ _0x9334[153])[_0x9334[141]](_0x9334[140])[_0x9334[139]]());_0x3f69xe[_0x9334[87]]()[_0x9334[146]](_0x3f69x1c);_0x3f69x1c= _0x3f69xe[_0x9334[87]]()[_0x9334[133]]();_0x3f69x1c[_0x9334[150]](_0x3f69x1c[_0x9334[147]]- 1,1,SpreadsheetApp[_0x9334[144]]()[_0x9334[143]]([_0x3f69xe[_0x9334[84]]()])[_0x9334[149]](_0x9334[92]+ _0x3f69x17+ _0x9334[152]+ _0x3f69x12+ _0x9334[153])[_0x9334[141]](_0x9334[154])[_0x9334[139]]());_0x3f69xe[_0x9334[87]]()[_0x9334[146]](_0x3f69x1c);var _0x3f69x14=_0x3f69x7[_0x9334[60]]();_0x3f69x7[_0x9334[108]]()[_0x9334[107]](SpreadsheetApp[_0x9334[106]].DOWN)[_0x9334[70]]();_0x3f69x14[_0x9334[109]]();_0x3f69x14= _0x3f69x7[_0x9334[60]]();_0x3f69x7[_0x9334[108]]()[_0x9334[107]](SpreadsheetApp[_0x9334[106]].DOWN)[_0x9334[70]]();_0x3f69x14[_0x9334[109]]();_0x3f69x7[_0x9334[60]]()[_0x9334[111]](_0x3f69x7[_0x9334[84]](),SpreadsheetApp[_0x9334[110]].PASTE_NORMAL,false)}function tatifno(){var _0x3f69x7=SpreadsheetApp[_0x9334[9]]();var _0x3f69x6=SpreadsheetApp[_0x9334[8]]();var _0x3f69x10=_0x3f69x7[_0x9334[72]](_0x9334[74]);var _0x3f69x11=_0x3f69x7[_0x9334[72]](_0x9334[76]);var _0x3f69x12=_0x3f69x6[_0x9334[48]](_0x9334[127],_0x3f69x6[_0x9334[47]].OK_CANCEL);if(_0x3f69x12[_0x9334[49]]()== _0x3f69x6[_0x9334[51]][_0x9334[50]]){var _0x3f69x12=_0x3f69x12[_0x9334[52]]()};var _0x3f69x1e=_0x3f69x7[_0x9334[60]]()[_0x9334[156]]()[_0x9334[155]](1);_0x3f69x7[_0x9334[60]]()[_0x9334[59]](_0x9334[92]+ _0x3f69x12+ _0x9334[157]+ _0x3f69x1e+ _0x9334[121]);_0x3f69x7[_0x9334[105]]()[_0x9334[104]](_0x9334[103]);var _0x3f69x14=_0x3f69x7[_0x9334[60]]();_0x3f69x7[_0x9334[108]]()[_0x9334[107]](SpreadsheetApp[_0x9334[106]].DOWN)[_0x9334[70]]();_0x3f69x14[_0x9334[109]]();_0x3f69x14= _0x3f69x7[_0x9334[60]]();_0x3f69x7[_0x9334[108]]()[_0x9334[107]](SpreadsheetApp[_0x9334[106]].DOWN)[_0x9334[70]]();_0x3f69x14[_0x9334[109]]();_0x3f69x7[_0x9334[60]]()[_0x9334[111]](_0x3f69x7[_0x9334[84]](),SpreadsheetApp[_0x9334[110]].PASTE_NORMAL,false)}function tatifyes(){var _0x3f69x7=SpreadsheetApp[_0x9334[9]]();var _0x3f69x6=SpreadsheetApp[_0x9334[8]]();var _0x3f69x10=_0x3f69x7[_0x9334[72]](_0x9334[74]);var _0x3f69x11=_0x3f69x7[_0x9334[72]](_0x9334[76]);var _0x3f69x12=_0x3f69x6[_0x9334[48]](_0x9334[127],_0x3f69x6[_0x9334[47]].OK_CANCEL);if(_0x3f69x12[_0x9334[49]]()== _0x3f69x6[_0x9334[51]][_0x9334[50]]){var _0x3f69x12=_0x3f69x12[_0x9334[52]]()};var _0x3f69x1e=_0x3f69x7[_0x9334[60]]()[_0x9334[156]]()[_0x9334[155]](1);_0x3f69x7[_0x9334[60]]()[_0x9334[59]](_0x9334[92]+ _0x3f69x12+ _0x9334[158]+ _0x3f69x1e+ _0x9334[121]);_0x3f69x7[_0x9334[105]]()[_0x9334[104]](_0x9334[103]);var _0x3f69x14=_0x3f69x7[_0x9334[60]]();_0x3f69x7[_0x9334[108]]()[_0x9334[107]](SpreadsheetApp[_0x9334[106]].DOWN)[_0x9334[70]]();_0x3f69x14[_0x9334[109]]();_0x3f69x14= _0x3f69x7[_0x9334[60]]();_0x3f69x7[_0x9334[108]]()[_0x9334[107]](SpreadsheetApp[_0x9334[106]].DOWN)[_0x9334[70]]();_0x3f69x14[_0x9334[109]]();_0x3f69x7[_0x9334[60]]()[_0x9334[111]](_0x3f69x7[_0x9334[84]](),SpreadsheetApp[_0x9334[110]].PASTE_NORMAL,false)}function iterative(){var _0x3f69xe=SpreadsheetApp[_0x9334[9]]();_0x3f69xe[_0x9334[160]](SpreadsheetApp[_0x9334[159]].ON_CHANGE);_0x3f69xe[_0x9334[161]](true);_0x3f69xe[_0x9334[162]](1);_0x3f69xe[_0x9334[163]](0.05)}function createSetup(){if(PropertiesService[_0x9334[0]]()[_0x9334[164]](_0x9334[6])!= 1&& PropertiesService[_0x9334[0]]()[_0x9334[164]](_0x9334[6])){var _0x3f69x7=SpreadsheetApp[_0x9334[165]]();var _0x3f69x22=_0x3f69x7[_0x9334[167]](_0x9334[166]);if(_0x3f69x22!= null){}else {_0x3f69x22= _0x3f69x7[_0x9334[168]]();_0x3f69x22[_0x9334[169]](_0x9334[166]);_0x3f69x22[_0x9334[176]]([_0x9334[170],_0x9334[171],_0x9334[172],_0x9334[173],_0x9334[174],_0x9334[175]]);_0x3f69x22[_0x9334[72]](_0x9334[177])[_0x9334[104]](_0x9334[103]);_0x3f69x22[_0x9334[72]](_0x9334[180])[_0x9334[179]](SpreadsheetApp[_0x9334[178]].CLIP);_0x3f69x22[_0x9334[72]](_0x9334[181])[_0x9334[59]](_0x9334[73])};var _0x3f69x23=_0x3f69x7[_0x9334[167]](_0x9334[182]);if(_0x3f69x23!= null){}else {_0x3f69x23= _0x3f69x7[_0x9334[168]]();_0x3f69x23[_0x9334[169]](_0x9334[182]);_0x3f69x23[_0x9334[176]]([_0x9334[172],_0x9334[173],_0x9334[183],_0x9334[184],_0x9334[185],_0x9334[186]])}}else {SpreadsheetApp[_0x9334[8]]()[_0x9334[188]](_0x9334[187])}}function createDB(){if(PropertiesService[_0x9334[0]]()[_0x9334[164]](_0x9334[6])!= 1&& PropertiesService[_0x9334[0]]()[_0x9334[164]](_0x9334[6])){var _0x3f69x7=SpreadsheetApp[_0x9334[165]]();var _0x3f69x25=_0x3f69x7[_0x9334[167]](_0x9334[182]);var _0x3f69x26=_0x3f69x25[_0x9334[189]]()- 1;var _0x3f69x3=_0x3f69x25[_0x9334[72]](2,1,_0x3f69x26,6)[_0x9334[190]]();var _0x3f69x27=[];for(var _0x3f69x28=0;_0x3f69x28< _0x3f69x3[_0x9334[147]];_0x3f69x28++){var _0x3f69x29=_0x3f69x3[_0x3f69x28];var _0x3f69x2a=_0x3f69x29[0];var _0x3f69x2b=_0x3f69x29[1];var _0x3f69x2c=_0x3f69x29[2];var _0x3f69x2d=_0x3f69x29[3];var _0x3f69x2e=_0x3f69x29[4];var _0x3f69x2f=_0x3f69x25[_0x9334[72]](_0x3f69x28+ 2,6);_0x3f69x2f[_0x9334[75]](_0x9334[191]+ _0x3f69x2a+ _0x9334[192]+ _0x3f69x2b+ _0x9334[193]+ _0x3f69x2a+ _0x9334[194]+ _0x3f69x2b+ _0x9334[195]);if(_0x3f69x28< _0x3f69x3[_0x9334[147]]- 1){var _0x3f69x30=_0x9334[196]+ _0x3f69x2e+ _0x9334[113]+ _0x3f69x2d+ _0x9334[197]+ _0x3f69x2f[_0x9334[128]]()+ _0x9334[198]}else {var _0x3f69x30=_0x9334[196]+ _0x3f69x2e+ _0x9334[113]+ _0x3f69x2d+ _0x9334[197]+ _0x3f69x2f[_0x9334[128]]()+ _0x9334[199]};_0x3f69x27[_0x9334[145]](_0x3f69x30)};var _0x3f69x31=_0x9334[200];for(var _0x3f69x32=0;_0x3f69x32< _0x3f69x27[_0x9334[147]];_0x3f69x32++){_0x3f69x31= _0x3f69x31+ _0x3f69x27[_0x3f69x32]};_0x3f69x31= _0x3f69x31+ _0x9334[201];_0x3f69x7[_0x9334[167]](_0x9334[166])[_0x9334[72]](_0x9334[202])[_0x9334[59]](_0x3f69x31);var _0x3f69x6=SpreadsheetApp[_0x9334[8]]();var _0x3f69x33=_0x3f69x6[_0x9334[48]](_0x9334[203],_0x3f69x6[_0x9334[47]].OK_CANCEL);if(_0x3f69x33[_0x9334[49]]()== _0x3f69x6[_0x9334[51]][_0x9334[50]]){var _0x3f69x34=_0x3f69x33[_0x9334[52]]()};var _0x3f69x35=_0x3f69x34[_0x9334[206]](_0x9334[204],_0x9334[205]);_0x3f69x35= _0x3f69x35[_0x9334[206]](_0x9334[207],_0x9334[208]);arrayFormula= _0x9334[209]+ _0x3f69x35;var _0x3f69x36=_0x9334[210];_0x3f69x7[_0x9334[167]](_0x9334[166])[_0x9334[72]](_0x9334[211])[_0x9334[59]](arrayFormula);_0x3f69x7[_0x9334[167]](_0x9334[166])[_0x9334[72]](_0x9334[212])[_0x9334[59]](_0x3f69x36)}else {SpreadsheetApp[_0x9334[8]]()[_0x9334[188]](_0x9334[187])}}



Telegram automatic

 var thesh = SpreadsheetApp.getActive().getSheetByName("Setup").getRange(26, 2, 6).getValues()

var token = thesh[1][0]

var fastSend = thesh[2][0]

var imprange = thesh[4][0]

var norepeat = thesh[5][0]


function onOpen() {

  var ui = SpreadsheetApp.getUi();

  ui.createMenu('Telegram')

      .addItem('Send Now', 'telegram')

      .addToUi();

}


function setTrigger(){

  removeTrigger()

  var time = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Setup").getRange("C15").getValue()

  createTrigger(time)


}


function createTrigger(time) {

  var ss = SpreadsheetApp.getActiveSpreadsheet();

  ScriptApp.newTrigger('telegram')

      .timeBased()

      .everyDays(1)

      .atHour(time)

      .create();

}


function createTriggerOnChange() {

  var ss = SpreadsheetApp.getActiveSpreadsheet();

  ScriptApp.newTrigger('telegram')

      .forSpreadsheet(SpreadsheetApp.getActive())

      .onChange()

      .create();

}


function removeTrigger() {

  // Loop over all triggers.

  var allTriggers = ScriptApp.getProjectTriggers();

  for (var i = 0; i < allTriggers.length; i++) {

    // If the current trigger is the correct one, delete it.

    if (allTriggers[i].getUniqueId() == allTriggers[i].getUniqueId()) {

      ScriptApp.deleteTrigger(allTriggers[i]);

      break;

    }

  }

}



function telegramf() {

  var throttle = 0

  var nlen2 = 0

  var ss = SpreadsheetApp.getActiveSpreadsheet()

  var sheet = ss.getSheetByName("Data")

  var lastRow = sheet.getLastRow() - 1

  var date = new Date()

  var data = sheet.getRange(2, 1, lastRow, 12).getValues()

  var data1 = sheet.getRange(1, 1, 1, 12).getValues()

  var end = data.length

  if (fastSend === "Yes") {

  var nlen2 = data.filter(function(value){return value[11]}).length

  }

  if (imprange === "Yes") {

  var end = data.filter(function(value){return value[0]}).length

  }

  var messaget = ss.getSheetByName("Template").getRange("B1").getValue()

  for (var i = nlen2; i < end; ++i){

  if (throttle >= 8) {

    Utilities.sleep(10000)

    throttle = 0

  } else {

    throttle = throttle + 1

  }

  var message = messaget

  var row = data[i];

  var mobile = row[0].toString()

  if (row[10] <= date){

  for (var g = 1; g < 11; ++g){

    var temp = row[g-1]

    if (temp instanceof Date) {

    temp = temp.toLocaleDateString("en-US")

    }

    var message = message.replace("$("+data1[0][g-1]+")",temp)

    }

  var existinStatus = data.filter(function(value){

    if (value[11].toString() === message) {

      return "yes"

    }

  })

  var strictNoRepeat = existinStatus.length

  if (norepeat === "Off") {

    strictNoRepeat = 0

  }

  if (message != row[11] && strictNoRepeat === 0) {

  if(sendMessage(mobile,message) === 1){

    sheet.getRange(2 + i,12).setValue(message);

  } else {

  sheet.getRange(2 + i,12).setValue("Failed");

      }

  }

    

    }  

}

}



function sendMessage(chat_id, text) {

  var data = {}

  var allContacts = chat_id.split("&")


  try {

  for (var i = 0; i < allContacts.length; ++i){

    var number = allContacts[i]

    data = {

    method: "post",

    payload: {

      method: "sendMessage",

      chat_id: String(number),

      text: text,

      parse_mode: "HTML",

      disable_web_page_preview: true

    }

    }


  var sendNow = UrlFetchApp.fetch("https://api.telegram.org/bot" + token + "/", data);

  var b = sendNow

    }  

  return 1

  } catch (e) {

    return 2

  }

}


function telegram() {

var lock = LockService.getScriptLock();

lock.waitLock(60000);

telegramf()

lock.releaseLock();

}


Thursday, February 24, 2022

Data copy paste on two another sheet with add row in google sheet by script

 function copyDataWithinWorkbook() {   var sourceSheetName = "Dashbord"; // Replace with the name of the source sheet   var target...