google-apps-script

Script 'setValues' method interprets strings as numbers in cells

偶尔善良 提交于 2021-02-04 08:12:12
问题 I have been using Apps Script in Google Sheets with methods getValues and setValues . The returned values in the arrays are further manipulated, and they are meant to be JS Strings and set in cells as Text. After using setValues the values inside cells are interpreted as (special format) numbers, if the string allows it, and inside the cells they are actually numbers even though the values inside the array are JS Strings. Can we tell via script that these string values be set as Text in cells

moving files between two folders in a shared drive - Cannot use this operation on a shared drive item

戏子无情 提交于 2021-02-04 08:09:20
问题 I have code to move files from one folder to another. It does not work on two folders in the **same shared drive*. I get the following error: Exception: Cannot use this operation on a shared drive item. function moveFilesFromFolderToFolder(sourceFolderID, destinationFolderID) { var sourceFolder = DriveApp.getFolderById(sourceFolderID); var destinationFolder = DriveApp.getFolderById(destinationFolderID); var sourceFiles = sourceFolder.getFiles(); while(sourceFiles.hasNext()) { var file =

What's the preferred way to insert a bulleted list into a Google Doc using Google Apps Script?

老子叫甜甜 提交于 2021-02-04 06:19:25
问题 I'm trying to get familiar with Google Apps Script in a Google doc and want to be able to insert a bulleted list with various levels of nesting. I thought I was using body.insertListItem correctly, but what's odd is that when I add subsequent list item, it seems to mess up the nesting levels and glyphs of previously inserted items. For example, here's my sample code: function myFunction() { var doc = DocumentApp.getActiveDocument() var body = doc.getBody() var cursor = doc.getCursor() var

What's the preferred way to insert a bulleted list into a Google Doc using Google Apps Script?

岁酱吖の 提交于 2021-02-04 06:19:05
问题 I'm trying to get familiar with Google Apps Script in a Google doc and want to be able to insert a bulleted list with various levels of nesting. I thought I was using body.insertListItem correctly, but what's odd is that when I add subsequent list item, it seems to mess up the nesting levels and glyphs of previously inserted items. For example, here's my sample code: function myFunction() { var doc = DocumentApp.getActiveDocument() var body = doc.getBody() var cursor = doc.getCursor() var

Running async functions on Google Apps Script

别等时光非礼了梦想. 提交于 2021-02-04 05:18:51
问题 I am attempting to run WebAssembly on the new V8 Google Apps Script runtime, and it appears to be supported, however it seems that async functions are terminated after they return a Promise. let wasm= new Uint8Array([/* snip */]).buffer function add(a,b) { return((async()=>{ console.log("running function...") results=await WebAssembly.instantiate(wasm) return results.instance.exports.add(a,b) })()); } function test(){ add(2,3).then(console.log).catch(console.error) } when I run test "running

Running async functions on Google Apps Script

孤者浪人 提交于 2021-02-04 05:05:35
问题 I am attempting to run WebAssembly on the new V8 Google Apps Script runtime, and it appears to be supported, however it seems that async functions are terminated after they return a Promise. let wasm= new Uint8Array([/* snip */]).buffer function add(a,b) { return((async()=>{ console.log("running function...") results=await WebAssembly.instantiate(wasm) return results.instance.exports.add(a,b) })()); } function test(){ add(2,3).then(console.log).catch(console.error) } when I run test "running

Running async functions on Google Apps Script

落爺英雄遲暮 提交于 2021-02-04 05:04:20
问题 I am attempting to run WebAssembly on the new V8 Google Apps Script runtime, and it appears to be supported, however it seems that async functions are terminated after they return a Promise. let wasm= new Uint8Array([/* snip */]).buffer function add(a,b) { return((async()=>{ console.log("running function...") results=await WebAssembly.instantiate(wasm) return results.instance.exports.add(a,b) })()); } function test(){ add(2,3).then(console.log).catch(console.error) } when I run test "running

Google apps script drive file: How to get user who last modified file?

℡╲_俬逩灬. 提交于 2021-02-04 04:56:46
问题 To get the date a file was last updated you can call getLastUpdated() How to I get the user who did this last update in google apps script code? I have tried to run the code under listing revisions at Advanced Drive Service var revisions = Drive.Revisions.list(fileId); but I get ReferenceError: "Drive" is not defined. 回答1: https://developers.google.com/apps-script/guides/services/advanced In Resouces > Advanced Google services, turn on Drive API... In that same window > click Google Developer

Why I can' see new version google apps script editor?

痴心易碎 提交于 2021-02-02 09:54:41
问题 I'm in Japan. By now I still just can see the legacy version. Anyone know why? I googled but got no answer. And there is no button for switch between legacy version and the new version. 回答1: Updates from workspace blog say Update This post has been updated to reflect a change in rollout pace. It is now an extended rollout (longer than 15 days for feature visibility), which we expect to complete in January 2021. We previously stated it would be a gradual rollout (up to 15 days for feature

Why I can' see new version google apps script editor?

£可爱£侵袭症+ 提交于 2021-02-02 09:53:33
问题 I'm in Japan. By now I still just can see the legacy version. Anyone know why? I googled but got no answer. And there is no button for switch between legacy version and the new version. 回答1: Updates from workspace blog say Update This post has been updated to reflect a change in rollout pace. It is now an extended rollout (longer than 15 days for feature visibility), which we expect to complete in January 2021. We previously stated it would be a gradual rollout (up to 15 days for feature