gadget in site with custom setting fields - google-apps-script

I'm wondering if the following is possible.
When you insert your gadget in a site page, you can config some settings such as height, border and url.
Is it possible to add custom fields to config the gadget?
For example, use selects the gadget (url), then additional fields appear.

There's workarounds to achieve such functionality (i.e. have a set of parameters for a script per sites page), but it's not possible to do specifically what you're asking. i.e. to put a parameter field on the script gadget interface.
Anyway, that seems like a real good enhancement Apps Script gadgets for Sites could have. You could open an enhancement request on Apps Script issue tracker.

Related

Set a custom favicon for different google spreadsheets

I use a lot of different google spreadsheets for day to day tasks.
Sometimes all of them are open at once, and combined with other websites needed it's a lot of open tabs, so the tab header is only the sheets favicon.
I'm looking for a way to add a custom favicon to each spreadsheet using Google Apps Script, to make it easier to identify them when only the icon is visible.
I've found a Chrome extension (https://chrome.google.com/webstore/detail/favicon-changer/ijaabbaphikljkkcbgpbaljfjpflpeoo) which changes the favicon to a specific file I choose, but I need a way to do it natively to each spreadsheet so that it works on any computer.
There's also a different extension which also changes the favicon, but to a random one you can't choose (https://chrome.google.com/webstore/detail/favidenticon-for-google-d/alkonpgilhahbbhihdjnamkmckfajmjo).
Since theres a way to code it in an extension, I'm wondering if there's a way to code it directly in Google Apps Script, assigning a specific file as the favicon.
I've fonund also that there's a setFaviconUrl(iconUrl) method in Class HtmlOutput, but I think it's for Web Apps, I've tried using it but haven't managed to make it work:
https://developers.google.com/apps-script/reference/html/html-output#setfaviconurliconurl
I have the icon files uploaded to a website in case that's needed (this is one of them https://www.botix.com.ar/imagenes-empresa/favicon-pedidos.ico)
I know little about code, so any help would be appreciated!
I am afraid that it is not possible at this moment. The extension you mentioned probably does not work with Google Apps Script and it may be modifying or working with Chrome specific settings or tools.
Since Google Apps Script is not able to work with Chrome related tools or APIs it would not be possible to use Google Apps Script to accomplish this. That is why the only options available are related to Chrome extensions or for web apps as you mentioned.
You can submit this as a feature request for Google Apps Script using this link

How to Add Hyperlinks to Google Forms user Google Apps Script

I'm trying to use Google Apps Script to add hyperlinked rows to a GridItem, ideally that act as tooltips. Am I trying to do more than is possible with Google Apps Script?
Here's the situation: I have a GridItem type question that has lengthy row descriptions. To clean up the interface, I'd like to present a short summary of the description that, when clicked/hovered, reveals the full text. To do this, I'd need to turn the short summary into a hyperlink. However, I haven't seen any way to insert hyperlinks in GridItem rows. I thought that Google Apps Script may allow me to do this.
So far, I've tried entering a string followed by .setLinkUrl(), using createAnchor('text', url), using markdown, and actually inserting, as text, <a href='http://google.com'>Google</a>' for the row. Nothing has worked so far.
Is this possible at all?
EDIT:
I apologize - I didn't research this question well enough before posting. Turns out Google Forms auto-detects URLs and posts them as links in the live form. I still have an issue with this, though - I'd rather have some specified text displayed to the user instead of the URL (some of my URLs are lengthy). Anyone know how to do this?
You can design the main elements of the Google form the normal way. Then preview the live form, copy the generated html file, hosted in your website.
Then you can replace the <a>...</a> tag that is generated by Google Form by one you need e.g. <a href='http://google.com'>Google</a>
keep sure you don't disturb any styles or code that may be needed by the Google form to work.
This solution need to have your own web hosting.
You will need to point your users to your website not the live form preview.

Chrome Extension or Gmail Contextual Gadget?

I've been looking into adding an "extension" for gmail, this is for an application at work, basically we want to somehow integrate some options (buttons), somewhere contextual to the email that's being viewed currently.
Our users, will then be able to install extension, and the extension will establish the authorisation aspect (not sure how this is done yet) with our application.
I've so far looked into two options, not sure if I'm on the right track:
Chrome extension, that then uses gmail.js (some third party library on github), and use some jquery to search the DOM to insert a button into the reply/delete toolbar.
I understand that this would be more straight forward but would have issues with it breaking if page layout changes, or class names changes. And would also require uses to be using chrome (which is something we are fine about)
Create a gmail contextual gadget add-on, that sits at the bottom of the email, although, I'm not sure if this contextual gadget will appear at the end of the main thread of an email or inside each individual email and will require expanding?
Also correct me if I'm wrong, but are gmail contextual gadgets limited to users with Google Apps subscription in their company? I.e. we have to subscribe to google apps in our domain and deploy it on the google apps marketplace, and similarly also have the users who want to install this gadget to also be using google apps?
Thank for everyones help in advance.

URL parameters stripped on Google Sites?

Using Google Apps Script gadget, I can use the parameters of the URL (http://sites.google.com/.../my-page?urlparameter=value&otherurlparameter=value) added to a Google Sites webpage to generate dynamic content.
But if you try to add a link to a page of a Google Site with parameters, and then save your page, the parameters are deleted : http://sites.google.com/.../my-page?urlparameter=value&otherurlparameter=value becomes http://sites.google.com/.../my-page. Same thing when trying to publish a webpage using Apps Script Service SitesApp.Page.setHtmlContent(yourHmtl).
It doesn't happen when using external URLs.
How can we bypass this limitation ?
It's possible to include relative links to pages including parameters.
Example :
in http://sites.google.com/.../home/page-1,
a link like http://sites.google.com/.../home/page-2?urlparameters will be overwritten without parameters but ../page-2?urlparameters won't be.

Can I use Google Drive's editor interface embed in a website?

I want to use google drive to store the files, but allow the users of my website to be able to edit them transparently, so that they don't have to go to google drive's website.
Is this possible with the current API? Thus far I have only seen how to create an app for them to install in google drive, or doing something like DrEdit (https://developers.google.com/drive/examples/), which parses the files to JSON and uses the ACE editor, which is definitely not what I want.
EDIT:
I believe it is not possible to do this with Google Drive, I've decided to go with Zoho Docs instead.
Yes it's possible. The biggest consideration is how much formatting you want to support. Eg. if it's plain text, it's very simple. If you want to support character or layout formatting, it becomes more complex.
I don't believe its possible to embed the editor (or even embed a preview!) using an iframe, because if you look at how the google docs page loads, it first redirects you to the login page, and that automatically logs you in if you are already logged in, and redirects you back to the docs editor.
This means that the iframe would have to at least pass through the login page, even if the user doesn't need to enter anything. However, google's login page has the x-frame-option header set to SAMEORIGIN (or deny?), and thus, the browser refuses to display it, and thus you can't actually get logged in!
The only way I've found to enable just preview embedding (not editing), is to publish the document first (via the File->publish to web menu item).