Transforms the data of a given Spreadsheet Sheet to JSON.
- The frozen rows are taken as keys for the JSON.
- The data taken for the values is only that after the frozen rows
exportJSON(Spreadsheet) - transforms the data in the given sheet to JSON.
| /* | |
| updated 2018-04-28 | |
| source lives here: https://gist.github.com/nicobrx/2ecd6fc9ca733dcd883afebba5cf200e | |
| standalone script ID for use as a library: 1gZ78JObyrYiH0njoZ86fQ2NgMwavUgiXVhRDrIFetPZL256e31PSNiHq | |
| Functions included here: | |
| Sheets data array and object functions | |
| objectifySheet(sheet,propertyNames,newPropertyNames) - Takes a sheet with a header row and converts it into an array of objects | |
| arrayFromSheet(sheet,propertyNames,newPropertyNames) - creates an array from a sheet, can specify column headers |
| |
| <head><style>*{margin:0;padding:0;text-decoration:none;vertical-align:middle}p{font-family:Arial,sans-serif;font-size:14px;line-height:16px;text-decoration:none}.disclaimer{padding-left:2px;color:#000;font-family:Arial,sans-serif;font-size:10px;line-height:14px;letter-spacing:.02em;font-style:italic;width:450px;text-align:justify}.main{width:450px}img{align:top}a{color:#808285!important;font-size:11px;text-decoration:underline}</style></head><div class="main"><table><tr><span style="font-family:arial,sans-serif;color:#808285;font-size:11px">*****************<br>Texas law requires all license holders to provide the <a href="https://members.har.com/mhf/terms/dispBrokerInfo.cfm?sitetype=aws&cid=653927">Information About Brokerage Services</a> and <a href="https://www.trec.texas.gov/sites/default/files/pdf-forms/CN%201-3.pdf">Texas Real Estate Commission Consumer Protection Notice</a> <br>*****************</span></tr><tr><td><img src="https://res.cloudinary.com/john-reside/image/upload/v1608585093/EnergyRealtyLog |
| function getDriveFiles() { | |
| const folderToUpdate = DriveApp.getFolderById('1L_AWb4RbnpTj2NS5G7kbxIRuxtProCvb'); | |
| const files = folderToUpdate.getFiles(); | |
| let arr = []; | |
| while (files.hasNext()) { | |
| file = files.next(); | |
| arr.push(({id: file.getId(), name: file.getName()})); | |
| } | |
| return arr; | |
| } |
| const renameKeys = (keysMap, obj) => | |
| Object.keys(obj).reduce( | |
| (acc, key) => ({ | |
| ...acc, | |
| ...{ [keysMap[key] || key]: obj[key]}, | |
| }), {} | |
| ) | |
| const JSONtoCSV = (arr, columns, delimiter = ',') => | |
| [ |
| <div id="toolbar"> | |
| <div id="title"> Rich-text Editor </div> | |
| <button id="bold" onclick="makeBold()"> Bold </button> | |
| <button id="italic" onclick="makeItalic()"> Italic </button> | |
| <button id="underline" onclick="doUnderline()"> Underline </button> | |
| <button onclick="justifyLeft()"> Justify Left </button> | |
| <button onclick="justifyCenter()"> Justify Center </button> | |
| <button onclick="justifyRight()"> Justify Right </button> |
You don't really need a framework or fancy cutting-edge JavaScript features to do two-way data binding. Let's start basic - first and foremost, you need a way to tell when data changes. Traditionally, this is done via an Observer pattern, but a full-blown implementation of that is a little clunky for nice, lightweight JavaScript. So, if native getters/setters are out, the only mechanism we have are accessors:
var n = 5;
function getN() { return n; }
function setN(newN) { n = newN; }
console.log(getN()); // 5
setN(10);
| const readline = require('readline') | |
| /** | |
| * Create an active bound readline interface using `stdin` and `stdout`. | |
| * | |
| * @param {function(string): void} callback handler for each inputed line | |
| * @returns {readline.ReadLine} the active configured interface | |
| */ | |
| function createReadlineInterface(callback) { | |
| const rl = readline.createInterface({ |
| //Example 1 - Calculate average value of an array (transform array into a single number) | |
| var scores = [89, 76, 47, 95] | |
| var initialValue = 0 | |
| var reducer = function (accumulator, item) { | |
| return accumulator + item | |
| } | |
| var total = scores.reduce(reducer, initialValue) | |
| var average = total / scores.length | |
| /*Explain about function |