google-apps-script

jsonp ajax in google script

冷暖自知 提交于 2020-06-23 18:37:05
问题 I'm trying to learn how to query for data from a local government data site (hoping I can teach my math students to do some data analysis). I'm hoping to get the data and insert them into Google Sheets. The following is a sample provided by the official site on how to do a query: var data = { resource_id: '1b702208-44bf-4829-b620-4615ee19b57c', // the resource id limit: 5, // get 5 results q: 'jones' // query for 'jones' }; $.ajax({ url: 'https://data.gov.sg/api/action/datastore_search', data

jsonp ajax in google script

六眼飞鱼酱① 提交于 2020-06-23 18:36:13
问题 I'm trying to learn how to query for data from a local government data site (hoping I can teach my math students to do some data analysis). I'm hoping to get the data and insert them into Google Sheets. The following is a sample provided by the official site on how to do a query: var data = { resource_id: '1b702208-44bf-4829-b620-4615ee19b57c', // the resource id limit: 5, // get 5 results q: 'jones' // query for 'jones' }; $.ajax({ url: 'https://data.gov.sg/api/action/datastore_search', data

Inserting an Image From Google Drive or from a URL into Google Sheets with Google Apps Script

耗尽温柔 提交于 2020-06-23 09:57:29
问题 I was using this script below to insert images from a URL into specified cells in Google Sheets, however, it won't work for image URLs contained within Google Drive. //If any graphic is a URL, insert that URL into the corresponding cell in the Briefing tab. var ss = SpreadsheetApp.getActiveSpreadsheet(); var source = ss.getSheetByName("main_gen").getRange("ImageRange").getValues(); var dstSheet = ss.getSheetByName("Briefing"); for (var num = 0; num < source.length; num ++) { if (/https?:\/\//

Open google document in a compact form / switching to a compact form

纵饮孤独 提交于 2020-06-23 08:55:09
问题 In my project I load a google document into a separated div. Google document interface includes a button which hides the menu and switches the view to a more compact form. My question is - is it possible to switch to a compact view with the javascript? I can open document in a preview mode https://docs.google.com/spreadsheets/d//preview but it is not very usefull (compact mode is much better) Button that is responsible for switching to compact view has the id viewModeButton but the following

Open google document in a compact form / switching to a compact form

守給你的承諾、 提交于 2020-06-23 08:54:12
问题 In my project I load a google document into a separated div. Google document interface includes a button which hides the menu and switches the view to a more compact form. My question is - is it possible to switch to a compact view with the javascript? I can open document in a preview mode https://docs.google.com/spreadsheets/d//preview but it is not very usefull (compact mode is much better) Button that is responsible for switching to compact view has the id viewModeButton but the following

Header section within Google Docs

这一生的挚爱 提交于 2020-06-23 07:36:32
问题 So, i have ammended some code to add the description field of a file search to a spreadsheet, which is potentially useful for me. However, ideally I want to conduct a file search and then add the details within the header section of a google document to a spreadsheet column. The problem line I assume is: var header= file.getHeader(); How do I query the search performed to return the contents of the document header? Can anyone help with this please? function onOpen() { var ss = SpreadsheetApp

Header section within Google Docs

坚强是说给别人听的谎言 提交于 2020-06-23 07:36:11
问题 So, i have ammended some code to add the description field of a file search to a spreadsheet, which is potentially useful for me. However, ideally I want to conduct a file search and then add the details within the header section of a google document to a spreadsheet column. The problem line I assume is: var header= file.getHeader(); How do I query the search performed to return the contents of the document header? Can anyone help with this please? function onOpen() { var ss = SpreadsheetApp

Accessing shared drive with DriveApp

a 夏天 提交于 2020-06-23 03:47:09
问题 I am trying to create a new file in a shared drive using google apps script so that other people using the shared drive can also access the file. Is there a method on DriveApp that allows me to do that? I have tried using DriveApp.getFoldersByName but this is for the root folder in my private drive only. 回答1: You need to use the Advanced Drive Service based on the Drive API The method Drive.Drives.insert allows you to specify the Drive Id. Keep in mind that for shared drives, you need to

get Entry ID which is used to pre-populate fields (Items) in a Google Form URL

送分小仙女□ 提交于 2020-06-23 03:07:35
问题 NOTE: This question is not about finding ID of an Item (form element), but an ID of Entry. These are different things. Entry ID is a number which is used to pre-populate fields (Items) in a form URL. As described here https://developers.google.com/apps-script/reference/forms/text-item it is possible to get a TextItem ID (actually, any Item ID) via getID() method. If you open any public Google Form HTML source code you will see something like this in the var FB_PUBLIC_LOAD_DATA : [232495719,

MailApp.sendEmail Error Message - “do not have permission to call sendEmail” [duplicate]

ぃ、小莉子 提交于 2020-06-22 15:36:28
问题 This question already has an answer here : Not allowed to execute sendEmail() from custom function, but OK in script editor (1 answer) Closed 4 years ago . When I change something in my spreadsheet, the onEdit() trigger runs, and I can see all the msgbox's that I put in my code. My function stops at this line MailApp.sendEmail(emailAddress, subject, message); I never see the message 'Email sent!', and get an error in the EXECUTION TRANSCRIPT: You do not have permission to call sendEmail If I