background preloader

Google Apps Script

Facebook Twitter

  Google Developers. AppendRow(rowContents) Appends a row to the spreadsheet.

  Google Developers

This operation is atomic; it prevents issues where a user asks for the last row, and then writes to that row, and an intervening mutation occurs between getting the last row and writing to it. var ss = SpreadsheetApp.getActiveSpreadsheet();var sheet = ss.getSheets()[0]; // Appends a new row with 3 columns to the bottom of the// spreadsheet containing the values in the arraysheet.appendRow(["a man", "a plan", "panama"]); Parameters Return Sheet — the sheet, useful for method chaining Authorization Scripts that use this method require authorization with one or more of the following scopes: clearContents() Clears the sheet of contents, while preserving formatting information. // This example assumes there is a sheet named "first"var ss = SpreadsheetApp.getActiveSpreadsheet();var first = ss.getSheetByName("first");first.clearContents();

Extending Google Sheets   Google Apps Script lets you do new and cool things with Google Sheets.

Extending Google Sheets  

You can use Apps Script to add custom menus, dialogs, and sidebars to Google Sheets. It also lets you write custom functions for Sheets, as well as integrate Sheets with other Google services like Calendar, Drive, and Gmail. Most scripts designed for Google Sheets manipulate arrays to interact with the cells, rows, and columns in a spreadsheet. (1) Google Script comment j'ai fait ma première macro. (1) Another Google (Apps) secret? Apps Script - Mes projets. Clasp - The Apps Script CLI.

Search for Files and Team Drives   You can search for files with the files.list method of the Drive API.

Search for Files and Team Drives  

Domain administrators may also search for all Team Drives in the organization by setting the useDomainAdminAccess parameter with the teamdrives.list method. Both methods accept the q parameter which is a search query combining one or more search clauses. Each search clause is made up of three parts. Field Attribute of the file that is searched, e.g., the attribute title of the file. Operator Test that is performed on the data to provide a match, e.g., contains. Value The content of the attribute that is tested, e.g. the title of the file My cool document. Retrieving Files with Filename Included Special Characters using Google Apps Script · tanaike. Gists This sample script is for retrieving files with filename included special characters using Google Apps Script.

Retrieving Files with Filename Included Special Characters using Google Apps Script · tanaike

The files are used on Google Drive. The files with filename of special characters cannot be retrieved using DriveApp.getFilesByName().   Google Developers. How to Create a Spreadsheet in a particular folder via App Script. Google apps script - How to copy a file into a specific folder using DocsList? Google apps script - How to copy a file into a specific folder using DocsList? Tutorial: Removing Duplicate Rows in a Spreadsheet   Editor's Note: Romain Vialard is a Google Apps Script Top Contributor.

Tutorial: Removing Duplicate Rows in a Spreadsheet  

He has contributed interesting articles and blog posts about Apps Script. - Jan Kleinert December 2011, updated March 2018 Goal This tutorial shows how to avoid duplicates when you want to automate the process of copying data in G Suite and specifically how to remove duplicate rows in spreadsheet data. Apps-script-samples/ at master · gsuitedevs/apps-script-samples. MakeCopy(name, destination) from Class File. RemoveViewer(emailAddress) Removes the given user from the list of viewers and commenters for the File.

makeCopy(name, destination) from Class File

Advanced Array functions. Reduce() eventually returns a single item which is some operation performed on each item of an array.

Advanced Array functions

It's easy to see in this simple example, that previous will continue to be incremented until eventually the function returns the sum of every element in the array .map() returns a copy of an array with each element transformed by your anonymous function. In this example we'll combine .map() .. producing an array of the squares of the elements of the original array .. with reduce() .. adding them up to single value, as in the previous example. sum of the squares of the values in an array.

Arrays - Javascript call() & apply() vs bind()? Array.prototype.find() - JavaScript. The find() method returns the value of the first element in the array that satisfies the provided testing function.

Array.prototype.find() - JavaScript

Otherwise undefined is returned. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone and send us a pull request. See also the findIndex() method, which returns the index of a found element in the array instead of its value. If you need to find the position of an element or whether an element exists in an array, use Array.prototype.indexOf() or Array.prototype.includes(). Syntax. JavaScript Array filter() Method. JavaScript Array map() Method. JavaScript call apply and bind. Javascript - How do I add formulas to Google Spreadsheet using Google Apps Script? GSUnit - Google Apps Script Examples. GSUnit is a Google Apps Script based testing framework based on JUnit by Kent Beck and JSUnit by Edward Hieatt.

GSUnit - Google Apps Script Examples

It will allow one to run tests while developing. Checks that two values are equal (using ===) @throws GsUnit.Failure if the values are not equal @throws GsUnitInvalidAssertionArgument if an incorrect number of arguments is passed assert() Checks that the given boolean value is true. @throws GsUnit.Failure if the given value is not true @throws GsUnitInvalidAssertionArgument if the given value is not a boolean or if an incorrect number of arguments is passed assertTrue() Synonym for assertTrue @see #assert assertFalse() Google Sheets : le séparateur de millier et de décimale. Seuls les nombres à caractère cardinal prennent une espace (idéalement fine) entre les tranches de trois chiffres.

Google Sheets : le séparateur de millier et de décimale

Les nombres à caractère ordinal comme les années, les numéros de maison, de page, etc. ne prennent aucunes espaces intercalaires. Apps Script: JSON Example. Google Apps Script Tutorials and Examples. JSON (JavaScript Object Notation) is a great way to pass data around the Web. It is easy for humans to read and it’s easy to work with in most programming language (including Google Apps Script).

This post will show you a number of useful examples of how to work with JSON with Google Apps Script. (re)introducing JSON JSON refers to a syntax for organizing information in text, a MIME type, and a file type. They are all part of one big idea from Douglas Crockford (the guy in the picture). JSON Syntax has two structures: objects, key-value pairs; and arrays, lists of values.

Javascript - JSON in Google Apps Script.

Calendar & admin (Google Apps Script)

Slide (Google Apps Script)   Google Developers. How to deal with Google Drive API for Team Drive + some Apps Script code. Team Drive is the new service you can access if you are a Google G Suite Business or higher version user. With Team Drive you will solve one of the key business issue, the file ownership. All files in Team Drive belong to company and not to user. You will also have a better rights access management, more granularity. Let’s focus on Drive API for Team Drive with some examples. Google Drive API v2 or v3 ? Right now the v2 of Drive API is the one with more options, for the Team Drive endpoint both have the same route but with the v3 sometimes results are not full... so check both if you can’t find an information. For all the following example we will use the Drive API v2. How to import JSON data into Google Spreadsheets in less than 5 minutes. I’m writing this only a day after getting home from SXSW 2014. My company, Deloitte Digital, sent me because I led a project to build the Deloitte Round-Up apps in conjunction with Deloitte’s sponsorship of the conference.

One of the main functions of the microsite we built was to capture recruiting prospects from people visiting the Deloitte booth. We stored the prospect info in a database on Parse. Almost immediately, the request came in from the recruiting team to get that prospect data. So I exported the table into a JSON file, but felt bad about just handing a JSON file to non-technologists.

Google Apps Script to read JSON and write to sheet. Google Sheets Import JSON - IMPORTJSON Function - Chicago Computer Classes. How to define global variable in Google Apps Script. Clasp - The Apps Script CLI.   Google Developers. How to Make a Google Apps Script RESTful API or Service. You know what’s cooler than calling API’s and services with Google Apps Script? Making your own API with Google Apps Script. After playing around with my first REST API with Python and Bottle, I wondered how this could be done even cheaper and quicker; without worrying about the complexities of databases and hosting. The simplest oauth2 server in 130 lines : Google Spreadsheet and App Script. John Doerr on OKRs and Measuring What Matters. The New OKR Crash Course: An introduction to Objectives & Key Results. How to Handle GET and POST HTTP Requests in Google Apps Script - Digital Inspiration. With Google Apps Script, you can easily create a Web App that serves HTML, JSON, XML or plain text output using the HTML service.

When your publish your Google Script project as a web app, the script gets a public URL (think API) that can be invoked from external applications using either HTTP GET or POST requests with query parameters and request body. When publishing the script as a web app, make sure to choose “Allow anonymous access” and execute the script as yourself.   Google Developers. If you build a user interface for a script, you can publish the script as a web app.

For example, a script that lets users schedule appointments with members of a support team would best be presented as a web app so that users can access it directly from their browsers. Both standalone scripts and scripts bound to Google Workspace applications can be turned into web apps, so long as they meet the requirements below. Tout savoir sur les OKRs: comment les créer, les atteindre et les accompagner sur Trello. Vous voulez allez loin? Nous aussi! Chez Buffer, nous avons une vision: construire un outil de gestion des réseaux sociaux aussi incontournable chez les responsables marketing que Google Analytics l’est pour les propriétaires de sites web. Assez osé comme objectif, non?