function myFunction() { } function createDoc() { var doc = DocumentApp.create('Sample Document'); var body = doc.getBody(); var rowsData = [['Plants', 'Animals'], ['Ficus', 'Goat'], ['Basil', 'Cat'], ['Moss', 'Frog']]; body.insertParagraph(0, doc.getName()) .setHeading(DocumentApp.ParagraphHeading.HEADING1); table = body.appendTable(rowsData); table.getRow(0).editAsText().setBold(true); } function uuri1(){ console.log(DocumentApp.getActiveDocument().getBody().getText()); var body=DocumentApp.getActiveDocument().getBody(); body.insertParagraph(0, "Juku võttis ranitsa seljast.").editAsText().setItalic(true); //body.insertParagraph console.log(body.getParagraphs().length); body.insertParagraph(body.getParagraphs().length, "Juku võttis taas ranitsa seljast.").editAsText().setBold(true); } function uuri2(){ var dok=DocumentApp.openByUrl("https://docs.google.com/document/d/1CtSSsMS_6OW6z8ahSYrgdeHA33KpzAgTid5HWnxmGT8/edit") var pd=dok.getBody().getParagraphs(); console.log(pd.length) console.log(pd[0].getText()) // dok.addViewer("narisa@tlu.ee"); // dok.addEditor("reimor@tlu.ee"); console.log(pd.map(p => p.getText()).join("\n")); console.log(dok.getAs("application/pdf").getName()); //SpreadsheetApp.create("Juku andmed").getSheets()[0].getRange(2, 3).setValue(pd.length); //DriveApp.createFile(dok.getAs("application/pdf")); console.log(dok.getBody().getText()); console.log(dok.getBody().findText("Ju")); console.log(DriveApp.getStorageLimit()); console.log(DriveApp.getStorageUsed()); var loetelu=DriveApp.getFiles(); /* while(loetelu.hasNext()){ let f=loetelu.next(); console.log(f.getName()+" "+f.getSize()); } */ // DriveApp.createFile() } function failid1(){ // var loetelu=DriveApp.getFilesByType("application/pdf"); // var loetelu=DriveApp.getFilesByName("Hellooo"); var kaust=DriveApp.getFoldersByName("oma"); while(kaust.hasNext()){ console.log("kaust olemas"); let failid=kaust.next().getFilesByName("setu_kargus_koos.mp4"); while(failid.hasNext()){ console.log(failid.next().getSize()); } } /* while(loetelu.hasNext()){ let f=loetelu.next(); console.log(f.getName()+" "+f.getSize()); }*/ } function printDocTitle() { var documentId = '1CtSSsMS_6OW6z8ahSYrgdeHA33KpzAgTid5HWnxmGT8' var doc = Docs.Documents.get(documentId) Logger.log('The title of the doc is: %s', doc.title) } function setFont() { var body = DocumentApp.getActiveDocument().getBody(); var text = body.editAsText(); text.insertText(0, 'Scriptiga sisestatud tekst.\n'); text.appendText('\nScriptiga l2ppu sisestaud tekst'); text.setForegroundColor(0, text.getText().length / 2, '#00FFFF'); text.setFontSize(0, text.getText().length / 2, '22'); text.setFontFamily(0, text.getText().length / 2, 'Times New Roman'); text.setBold(0, text.getText().length / 2, true) } function selekteerimine1(){ var selection = DocumentApp.getActiveDocument().getSelection(); if (selection) { var elements = selection.getRangeElements(); DocumentApp.getUi().alert('Number of selected elements: ' + elements.length); } else { DocumentApp.getUi().alert('Nothing is selected.'); } } function selekteerimine2(){ var sel=DocumentApp.getActiveDocument().getSelection(); if(sel){ var el=sel.getRangeElements(); for(var i=0; iA change of speed, a change of style...

') .setWidth(250) .setHeight(300); // DocumentApp.getUi().showModelessDialog(htmlOutput, 'My add-on'); DocumentApp.getUi().showModalDialog(htmlOutput, 'My add-on'); } function lisaMenyy(){ var ui = DocumentApp.getUi(); ui.createMenu('Minu lisatud menüü') .addItem('selekteeritu uuring', 'selekteerimine4') .addToUi(); }