Stream

Join this community to post or comment
 
 
New Google Apps Marketplace (Material Design UI) now list add-ons. I would presume that means more prospects / customers and users :)
https://apps.google.com/marketplace/
1
Riël Notermans's profile photo
 
Oooh there !
Add a comment...

Scott Marquardt

Problem/Coding Help  - 
 
Frustration with Cloud Print information.

Cloud Printing.

We're using a single resource account in the GAFE domain to manage printers/copiers. We have a LOT of them in our several schools. I see no obvious way of listing ALL the details for each printer; ya gotta drill down in the GUI when viewing individual printers. That's just wrong.

I can't find anything much on creating an apps script that could pull all that data into a Sheet, thus listing all the data for all the printers.

Anyone have a clue on how to do that? I'm coming up dry in the available documentation. Geez it'd be handy. 
1
Scott Marquardt's profile photoRiël Notermans's profile photo
3 comments
 
It should work great with a small server (NUC) and google cloud print what I tried.

Our experience with lantronix is... well lets say we are not using it anymore :)
Add a comment...

Jonathon Broughton

Case studies  - 
 
Sharing something i ran into today which hadn't come up before. 

I haven't pinned down the exact number, but it is worth noting that there seems to be an undocumented limit on the number of fields that may be POSTed to an Apps Script webapp. This seems to not be on aggregate size of the raw request, but number of fields. I have never come across anything like this before.

logging via pushbullet indicates that the POST never makes it as far as the script's doPost() but the server returns 400
4
Daniel Frost's profile photoRiël Notermans's profile photo
4 comments
 
So unstringified?
Add a comment...

Paula Moore

Problem/Coding Help  - 
 
Question:
I am generating a CSV files for each teacher in our building using a python program.  These csv files are shared with the teacher in Google drive.  They open it with Google sheets.  I would like to create something in Sheets so that when they open this file it formats into a standard, neat format (example: Make all font size 12, wrap one column that holds a long text string, make the row size bigger).

What is the best way for something to run in sheets automatically when they open this file -- is it an add-on or a script?  And how can I get this to happen seamlessly for them as soon as they open the CSV in sheets?

Thanks
1
Riël Notermans's profile photoMartin Hawksey's profile photo
3 comments
 
.. or do the whole thing in python and create a sheet https://developers.google.com/gdata/articles/python_client_lib?hl=en
Add a comment...

Eric Kamara

Problem/Coding Help  - 
 
I am trying to get all calendar events to which I have been invited but the filter option is not working. I am using the following code. What am I not doing right?: 

var calendarId = 'emailaddress@gmail.com';
var calendar = CalendarApp.getCalendarById(calendarId);
var start = new Date();
var end = new Date("September 30, 2015 00:00:00 UTC");
var invites = calendar.getEvents(start, end, {statusFilters:[CalendarApp.GuestStatus.INVITED]});

Thanks,
1
Johan Deknudt's profile photoEric Kamara's profile photo
2 comments
 
+Johan Deknudt You have misunderstood my question. I can get the calendar. What I am looking for are the events that I have been invited to on that particular calendar. When I take the filter option out and query for all the events on the calendar, I get them. This means to me that there is  problem with the way I am writing the filter. I have tried different options based on the documentation and it is still failing.
Add a comment...

A. Luca B

Problem/Coding Help  - 
 
Trigger authorization doesn't show from custom menu calling ScriptApp creation

I have a spreadsheet which must access on a iterative basis to some functionalities which need authorization (send emails, access files).

I have built the usual installable time trigger and everything works rather well.

Now, this is for a not tech savvy customer who should copy in multiple users of the domain the spreadsheet and activate the trigger for each one. So i have built a custom menu for the sheet with a function to programmatically install the trigger through ScriptApp service.

What happens is that if i select the item of the menu the script hangs and the system is not presenting the authorization window i would expect.

If i go in the ScriptEditor and call manually the install function everything works and the authorization window appears.

Is this normal ? I do not remember if this is an expected behaviour.
Doest the auth window appear only if you call directly the functionalities from a custom menu ?

I tried to install from a modal htmlservice with no success.

How do you manage installation of this functionalities on customer side ?

Perhaps an addon could overcome this problem ? It would seem me an overshoot for so a simple task ...

Thanks for your opinions!
1
A. Luca B's profile photoWeb Apps R&D's profile photo
5 comments
 
Just continue realizing your ideas and be careful not to trust anything unless it has been tested thoroughly. The hints are distributed across the functions where the contstraints matte, but it takes experience to realize the big picture.
Add a comment...
 
Register for Atmosphere Live and see how Google Apps can help your companies! Google Apps Scripts rule and at this event you will hear more about innovations and the road ahead. Miadria, Google for Work partner will be there for you to answer your questions #Atmosphere15   #Miadria  
 
Register at the link below and get exclusive access to Atmosphere Live event on October 21! 

It will be exciting and industry experts will talk about what the future of work holds. You'll hear from leading companies about how Google Apps enables companies and their employees to be more innovative with easy-to-use tools. You will learn why Google Apps is a cost effective alternative to traditional ways of working and how on top of all other benefits Google Apps also empowers users to be more productive at work by using tools that are familiar!

Register for Atmosphere Live on October 21!
Take a deep look into the future of work as experts at cutting-edge companies of today & tomorrow see it. View the agenda below to plan your journey with the world's forward-thinkers at Google for Work's digital event.10AM UK | 11AM Paris
1
Add a comment...

Edouard Brasier

Problem/Coding Help  - 
 
Hi guys,

I am trying to save data that I query on a website.
It looks something like 
http://www.fakedata.com/lookupproduct.asp?product=cars
I have tried 
var url = 'http://www.fakedata.com/lookupproduct.asp?product=cars';
var contents= UrlFetchApp.fetch(url).getContentText();

What I am capturing isn't the results but the source of the webpage not showing any results. 

Is there a way to get the results?

Thanks
1
Martin Hawksey's profile photoEdouard Brasier's profile photo
5 comments
 
Thanks +Martin Hawksey  I will definitely give it a try next time I need to scrap data.
Add a comment...

Alicia Campbell

Problem/Coding Help  - 
 
I use getLastRow() in my scripts to set values or set formulas. For example I would write:

var row = sheet.getLastRow();

But in this particular case I would also want to get the preceding row - that is, the row before the last row without going through the entire sheet to find it. Is there a quick way to do this?
Sorry for asking about it - I am very inexperienced.
Many thanks.
1
Edouard Brasier's profile photoAlicia Campbell's profile photo
18 comments
 
+Edouard Brasier
That was very helpful. I used your suggestion with .get Formula instead of getValue and it works for now in my test script. Many thanks! I'll try it with the script that runs on Form submission - but I think it will work.
Add a comment...
 
Posted by Dan McGrath, Product Manager, Google Drive

Beginning August 31st, 2015, web hosting in Google Drive for users and developers will be deprecated. You can continue to use this feature for a period of one year until August 31st, 2016, when we will discontinue serving content via googledrive.com/host/[doc id].

In the time since we launched web hosting in Drive, a wide variety of public web content hosting services have emerged. After careful consideration, we have decided to discontinue this feature and focus on our core user experience.

For those who have used Drive to host websites, Google Domains can refer you to third parties for website hosting functionality.

For those who use this feature to serve non-user content to web and mobile applications, Google Cloud Platform offers a better-performing solution.
3
Martin Hawksey's profile photoAlan Wells's profile photo
4 comments
 
In my opinion, the reason given for discontinuing web hosting in Google Drive is so pathetically lame.  I use it, but I had to go hunting for it.  Maybe I'm just stupid, but it seemed like a feature that was hard to find, and figure out how to use.  To me, it does make sense to deprecate it though.  It was going nowhere.
Add a comment...

About this community

Google Apps Script is a JavaScript cloud scripting language that lets you extend Google Apps and build web applications. Scripts are developed in Google Apps Script’s browser-based script editor, and they are stored in and run from Google’s servers. Community managed by - Ivan Kutil (Google Developer Expert) - Martin Hawksey (Google Developer Expert) - Romain Vialard (Google Developer Expert) - Bruce Mcpherson (Google Developer Expert) - Riël Notermans (Google Developer Expert) - Eric Koleda (Google)

Riël Notermans
moderator

Problem/Coding Help  - 
 
I am doing a small project in my free time to help a company to create speeddate table arrangements.

I have a list of users. I have a number of tables and seats per table. Each user has a 'category'. I want the script to create speeddate sessions:

- for each tables a new set of users that have not been sitting at the same table a round before.
- preferrably 4 different categories per table, if possible

The number or rounds seems irrelevant to me, the script could just go on until there are no possible rounds anymore, or stop at a given amount.

I bet these scripts/algorytms float around on the internet somewhere. Anyone has a good idea how to create the logic? I find the problem very fun, so maybe other people like to puzzle along :)
4
Add a comment...
 
 
Google Forms moves to Material Design, but without add-ons initially. However, Google tells me that add-ons, as well as, other features are coming soon.  http://googledocs.blogspot.com/2015/09/sidekicks.html

Based on a recorded Hangout from Google's Apps Script Manager about add-ons, I would guess that our add-on UIs will need to move to Material Design eventually. However, it is possible that users may use "old" Forms or "new" Forms so that could mean if add-ons are implemented within the "new" Forms before the "old" option is removed, the add-on UI could be out of sync.  Perhaps Google will wait until the "old" alternative option is removed (meaning all users are using "new" Forms).
5
1
Gino Naranjo's profile photo
Add a comment...

Brandon A. Lauer

Tips & tricks  - 
 
I have a spreadsheet that I keep a listing of my game schedules on that I would like send to my calendar. I would like this to be a dynamic update if I make changes.  Is this possible?
1
Michael Ellis's profile photoDaniel Frost's profile photo
2 comments
 
+Brandon A. Lauer Yes its possible. You would want your add-on to do a purge of current calendar event before writing a new one.
Add a comment...

Steve Webster

Tips & tricks  - 
 
I originally shared this when add-ons celebrated their 1 year anniversary within the Google Docs/Sheets/Form Add-On G+ community, but I thought it would be nice to share this here, too :)

Imagine your add-on or web app has been improved and you want to inform your users. One method is to display a pop-up dialog that only occurs once per improvement. For example, a user opens the app or add-on, the dialog appears and they get informed. However, when they open again it does not pop-up, because we do NOT want to bother them with nagging pop-ups with the same information.

Click the link to open a Google Doc that explains and contains code to get you started. Enjoy!  https://goo.gl/62YlpB
7
1
Ivan Kutil's profile photo
Add a comment...

Gerencia Hotel Playa

Problem/Coding Help  - 
 
hi there im having a little trouble with my code, first this is what i want the code to do:
i have 1 form wich collect data like name,  sur name. email and other info.
then i have a document wich works as a template  i have a function that makes a copy of the template and change the name, then  i use the information from the spreadsheet to replace the information  on the document. when i attach the document as a file in the email it send the document witout rhe changes, but when i check in Drive the document has all the data change.

here is the code :
function createDoc() {
  var ss = SpreadsheetApp.openByUrl('HERE GOES THE DOCUMENT LINK')
 var sheet = ss.getSheets()[0];
  var filaInicio = sheet.getLastRow();//seleccionamos la fila de inicio
  var numeroFilas = 1;// seleccionamos las filas que se van a procesar
  var rangoDeDatos = sheet.getRange(filaInicio, 2, numeroFilas, 4); // pedimos los rangos 
  var datos = rangoDeDatos.getValues();// pedimos los datos 
  
  for (i in datos){
    var columna = datos[i];
    var saludo = columna[0];
    var nombreAgencia = columna[1] ;
    var nombreContacto = columna[2];
    var email = columna[3];
  };
  
//Copia de Archivo 
  var carpetaReservas = DriveApp.getFoldersByName('Reservas');
  while (carpetaReservas.hasNext()){
    var documentoPlantilla = DriveApp.getFileById('HERE HOES THE TEMPLATE');
    var carpetaReservas = carpetaReservas.next();
    var copiaPlantilla = documentoPlantilla.makeCopy('cotizacion_' + nombreAgencia, carpetaReservas); 
};
  
  // aqui buscamos el id del archivo 
  var ids = DriveApp.getFilesByName('cotizacion_'+ nombreAgencia);
  while (ids.hasNext()){
    var id = ids.next();
    var id = id.getUrl();
  }
  

  //
  var plantillaNueva = DocumentApp.openByUrl("'" + id + "'");
  var body = plantillaNueva.getBody();
  var saludoDoc = body.replaceText('SALUDO', saludo);
   var saludoDoc = body.replaceText('NOMBREAGENCIA', nombreAgencia);
   var saludoDoc = body.replaceText('NOMBRECONTACTO', nombreContacto);
  
  var adjunto = DriveApp.getFilesByName('cotizacion_' + nombreAgencia);
     
  MailApp.sendEmail(email, saludo + ' ' + nombreContacto, 'Gracias por confiar en Hotel Playa Club, adjunto encontrara un archivo adjunto con la informacion solicitada', {attachments: [adjunto.next()]} );
}

pd i commented the while because is showing an error on the hasnext 
 ·  Translate
1
Riël Notermans's profile photoGerencia Hotel Playa's profile photo
2 comments
 
+Riël Notermans thanks a lot i tried that but not in the right place.
Add a comment...

Hannes Hoberg

Problem/Coding Help  - 
 
Hey guys,

Dropdown Options: Yes, No
If „Yes“ -> Send e-mail too „e-Mail address“

Do you have a script for me?

Thanks ;-)
1
Riël Notermans's profile photoHannes Hoberg's profile photo
3 comments
 
Hey guys,

Thank you for your answers. I appreciate it. :-) I am sorry, I should have said I need this for a google docs document. So the whole thing should work for example in cell CA3 to CA37. For example: If cell CA3 says “Yes” send e-Mail to xyz@gmail.com with content “ABC”. I know how to integrate it but I don't know a useful code. 

Best regards,

Hannes
Add a comment...

Stephen Gale

Problem/Coding Help  - 
 
I suck at User Interfaces.  I am looking for a way to populate a <select> element with options dynamically from a Google Apps Script.  When I try my current code, I get an undefined return.

******  Begin doSomething() ******
//variables defined above
  do{
    page = AdminDirectory.Orgunits.list(customerId,{
      domain: domain,
      type: 'all',
      maxResults: 100,
      pageToken: pageToken
    });
    for (i=0 ; i < page.organizationUnits.length; i++ ){
      if (userScope.test(page.organizationUnits[i].parentOrgUnitPath)){
        allOUs.push(page.organizationUnits[i])
      }  
    }
    pageToken = page.nextPageToken;
  }
  while(pageToken) 
  for (i in allOUs){
   htmlOption += "<option value ="+ allOUs[i].orgUnitPath +">"+ allOUs[i].name +"</option>;"
  }
Logger.log(htmlOption);
  return htmlOption;
}
****** End doSomething() ******

The HTML is 2 select Elements with a button that executes another function.  Presently it is hard coded, but I would like to make it dynamic taken from the above code

****** Start HTML file ******

<!doctype html>
<body>
<div id="container">
  <div>
  <!-- Define Target OU from Drop-down -->
    <span> Target Lab&nbsp;</span><select id="selector1"> 
     <option value="Trips Lounge">Trip's Lounge </option> 
     <option value="Distance Lab">Distance Lab </option> 
     <option value="North Lab">North Lab </option> 
     <option value="South Lab">South Lab </option>    
    </select>
  </div>
  <div>
  <!-- Define NewParentOU from Drop-down -->
    <span> Move To&nbsp;</span><select  id="selector2">
      <option value="HS/Students">HS/Students</option>
      <option value="K8/Students">K8/Students</option>
      <option value="NWEA Testing">NWEA Testing</option>
      <option value="Moby Max">Moby Max</option>
    </select>
  </div>
  <div id="run">
    <input type="button" value="Run"
 onclick="google.script.run.MoveOU(document.getElementById('selector1').value,document.getElementById('selector2').value)" />
  </div>
</div>
</body>
<script type="text/javascript">
var options = google.script.run.doSomething()
    document.getElementById('selector1').innerHtml = options;
</script>
****** End HTML file ******
1
Spencer Easton's profile photoStephen Gale's profile photo
3 comments
 
Many thanks +Riël Notermans and +Spencer Easton  I will test it at the end of the day when I have more time to tinker.
Add a comment...

Sergey Kozhin

Problem/Coding Help  - 
Test your JavaScript, CSS, HTML or CoffeeScript online with JSFiddle code editor.
1
Riël Notermans's profile photo
14 comments
 
Ah, good ;) 
Add a comment...

Marco Colombo

Tips & tricks  - 
 
Hello! How does .setNumberFormat('0.00') can be set to Automatic?
1
Rolando Hugo Garcia Villarreal's profile photoMarco Colombo's profile photo
2 comments
 
maybe I wrote wrong: what is the argument that should be inside the parenthesis of .setNumberFormat('0.00') instead of 0.00 to choose the Automatic mode?
Add a comment...