This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Use this script to add date in a specific column when a spcecific range/cell is edited in the same row. | |
| // To run this script, you must also add an event-based trigger to be run on edit. | |
| function addDate(e) { | |
| // Open the Google Sheet file | |
| var ss = SpreadsheetApp.getActiveSpreadsheet(); | |
| // Open the active sheet where you want to add the date |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Deletes sheets whose names contain the criteria string. Takes Spreadsheet URL and Criteria-string as arguments. | |
| function cleanSheets(url, criteriaString){ | |
| var ss = SpreadsheetApp.openByUrl(url) | |
| var sheets = ss.getSheets() | |
| for (var i=0; i<sheets.length; i++){ | |
| var sheetName = sheets[i].getSheetName(); | |
| if (sheetName.indexOf(criteriaString)>-1) {ss.deleteSheet(sheets[i])} | |
| } | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // This function takes a two-dimensional array and returns a flattened one-dimensional array | |
| function flattenArray(array){ | |
| var flatArray = [] | |
| for (var i = 0; i < array.length; i++) { | |
| flatArray.push(array[i][0]) | |
| } | |
| return flatArray | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Emails the whole sheet as PDF | |
| function emailGoogleSpreadsheetAsPDF(url, email, subject, body) { | |
| // All arguements are strings | |
| var ss = SpreadsheetApp.openByUrl(url) | |
| var blob = DriveApp.getFileById(ss.getId()).getAs('application/pdf'); | |
| blob.setName(ss.getName() + '.pdf'); | |
| // If allowed to send emails, send the email with the PDF attachment | |
| if (MailApp.getRemainingDailyQuota() > 0) | |
| GmailApp.sendEmail(email, subject, body, { | |
| htmlBody: body, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * Google Apps Script - List all files & folders in a Google Drive folder, & write into a speadsheet. | |
| * - Main function 1: List all folders and subfolders | |
| * - Main function 2: List all files, folders and subfolders | |
| * - You will receive information like file name, location, size, sharing, access information | |
| */ | |
| /* | |
| * - If this is your first project, open a blank Google Sheets, go to Tools, go to Script Editor, Paste the following code, | |
| * - and run the 'List All' Function. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function emailSheet() { | |
| var email = "email@email.com"; // Enter email here. You can add multiple emails by separating them with comma. | |
| var ss = SpreadsheetApp.openByUrl("GoogleSheetURL"); | |
| var subject = "Subject"; | |
| var body = 'Enter the message here' | |
| var url = "https://docs.google.com/spreadsheets/d/SS_ID/export?".replace("SS_ID", ss.getId()); | |
| var url_ext = 'exportFormat=pdf&format=pdf' | |
| + '&size=letter' | |
| + '&portrait=false' | |
| + '&fitw=true' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function getGradebooks() { | |
| var response = ui.alert('Alert!', 'Do you understand that this will create new copies of gradebooks?', ui.ButtonSet.YES_NO); | |
| if (response == ui.Button.YES) { | |
| var response2 = ui.prompt('Verification', 'What is the password?', ui.ButtonSet.OK_CANCEL).getResponseText(); | |
| if (response2 === 'password') { | |
| ui.alert('Magic is happening! Gradebooks are under construction.'); | |
| var DGsheet = SpreadsheetApp.openByUrl('url of dashboard').getSheetByName('Gradebooks').activate(); | |
| var urls = DGsheet.getRange('E2:E'); | |
| var icfile = DriveApp.getFileById('id of incharge template'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function doGet(request) { | |
| if (request.parameters.url != undefined && request.parameters.url != "") { | |
| var imageBlob = UrlFetchApp.fetch(request.parameters.url).getBlob(); | |
| var resource = { | |
| title: imageBlob.getName(), | |
| mimeType: imageBlob.getContentType() | |
| }; | |
| var options = { | |
| ocr: true | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| Google Apps Script - List all files & folders in a Google Drive folder, & write into a speadsheet. | |
| - Main function 1: List all folders and subfolders | |
| - Main function 2: List all files, folders and subfolders | |
| - Customization: You can make a few tweaks to change it according to your need but this can be a good starting point. | |
| */ | |
| var folderId = '' | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function ShowRows() { | |
| var ss = SpreadsheetApp.getActiveSpreadsheet(); | |
| var sheet = ss.getActiveSheet(); | |
| var lastRow = sheet.getLastRow(); | |
| for( i=1 ; i<=lastRow ; i++) { | |
| { | |
| sheet.showRows(i); | |
| } | |
| } | |
| }; |
NewerOlder