Stream

Join this community to post or comment

Oleg Moskalensky

Problem/Coding Help  - 
 
Dynamic Menu question
I have a custom menu which is dynamically built via the underlying spreadsheet.  Since there could be quite a few entries - I don't want to have a function for every row selection, instead I just want to get a single function, somehow retrieve the item number selected from the menu and then deal with it accordingly in my function.

Is that doable?  Can you get, programmatically, the number representing the item from a menu that was selected by a user?

Thanks much.
1
Oleg Moskalensky's profile photo
5 comments
 
Actually, come to think of it - that won't work either, since I need to somehow know the name of the selected option,, unless I made a function call for every menu selection, statically, which isn't very functional.
Add a comment...

Faustino Rodriguez

Problem/Coding Help  - 
 
Spreadsheet on Form Submit function stops recognizing e.range after adding any new authorization.
Is anybody else having this problem?

This is a very all issue with an annoying workaround,
I am trying to get some attention from G
Google Apps Script issues and feature requests. *Note*: This project is exempt from the read-only timeline listed above. Please continue to file issues here.
1
Alan Wells's profile photoJean-Pierre Verhulst's profile photo
2 comments
Add a comment...

Bjorn Behrendt (EdListen)

Problem/Coding Help  - 
 
Is there an automatic way I can find out which sheet in a spreadsheet is the data sheet that form entries go into, without asking the end user?
1
Bjorn Behrendt (EdListen)'s profile photoKim Nilsson's profile photo
7 comments
 
Yes, I figured that, but was hoping maybe you could haxor your way into the HTML, or know how to ask for the info now that you know where it is. 
Add a comment...

Keith Winston

Problem/Coding Help  - 
 
I've got a script, published as a Web App. I select "Execute as Owner", access by anyone, even anonymous. Then I try to run the script using the link in a different browser/different account, and it tells me I have to ask permission. I've already "run" a function in order to be sure it's authorized. What am I missing? It has to run as Owner due to what it does.
1
Alan Wells's profile photo
 
Does the URL that you are using have "exec" at the end? Or "dev"?

Add a comment...

Cameron Kluza

Problem/Coding Help  - 
 
Quick question:

If I want to get some values from a cell on a certain sheet with Google Apps Script (for example with .getValue), do I have to set that sheet as active (.setActiveSheet) or can I just use .getSheets()[0] followed by my .getValue()?
1
Bruce Mcpherson's profile photo
 
You don't have to set activesheet.

In fact getValues() and getValue() are methods of the Range class, so you need to simply define a range describing where the data is.

so for example this will get all the data on a particular sheet of the active workbook

var values = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('yoursheet').getDataRange().getValues();


Add a comment...

Jessica Rodrigueez

Problem/Coding Help  - 
 
Ok, so new to this spreadsheets app. I've used Excel before but not super experienced. I created a column that has drop down menus. The selections are "Not Confirmed" "Pending" and "Confirmed." What I need to do is when I select the option "Confirmed" that entire Row turns Green and gets sent to the Master Page sheet in the spreadsheet. Please help!
1
Martin Molloy's profile photo
2 comments
 
I decided it was just easier to create a demo spreadsheet - so here it is.

https://docs.google.com/spreadsheets/d/1-M7caujieaTPbBi9rSDjiqQiWeWFM8r7Zp88rvwMCU0/edit?usp=sharing

Add a comment...

Phillip Lanos

Problem/Coding Help  - 
 
Hello, I hope you are all feeling very rock n' roll! I Have a question that I need REAL experts for--

I have followed the google tutorial and successfully have the script running to send an email. What I would like to have help with will require my attachment for context: http://i.stack.imgur.com/ICxx3.png

I would like for three different pre written emails to be sent depending if I choose either value I created via a list. So I update with a new email in a new row and then go to the list cell I created values for and select approved from that list how I can I have an email automated for sending from the "approved" email I wrote as a template whenever I update that cell? I apologize if it is unclear.
1
Add a comment...

Kevin Boulier

Problem/Coding Help  - 
 
Is it possible to script a function that creates a site page for every row of a spreadsheet and have the page created from custom html template?

I have project coming up where users complete a form to be considered for a scholarship. From the form data I then need to create a place for judges to review and submit judging data.

In past years I've collected data via form and then merged to interactive pdf. I would really like to completely automate this project but am new to scripting but I am pretty new to apps script. Any advise would be greatly appreciated.
1
Riël Notermans's profile photoKevin Boulier's profile photo
9 comments
 
+Riël Notermans
I found examples of how to auto generate pages but not how to bring in my own HTML template.

I also need an example on how to pull a pre-populated form.

Any help is appreciated.

This is a fun distraction from the print project I'm currently working on.
Add a comment...

Clients First Realtors

Problem/Coding Help  - 
 
I'm in need of a script for Sheets that when i specific word is entered into a column, that row would be automatically transferred to another sheet within the same book.

Is this possible? If so, how can it be done? 

I should add that I know absolutely nothing about scripts and coding..

I apologize in advanced.
1
Clients First Realtors's profile photoSpencer Easton's profile photo
20 comments
 
+Clients First Realtors Sorry it looked like you and James worked out a solution so I butted out. 
Add a comment...

MSG Jeffery W. Crane

Problem/Coding Help  - 
 
Does anyone know how to getValue (or something like it) of a Google Visualization categoryFilter once a selection has been made?

I want to pass the value to a Google Sheet...

I have scoured the internet looking for the solution and have come up empty. Thanks in advance! 
1
Spencer Easton's profile photoMSG Jeffery W. Crane's profile photo
8 comments
 
Thanks for your help guys!
Add a comment...

Shawn White

Problem/Coding Help  - 
 
Script to automatically save a sheet monthly from Google Sheets.

I have a PO Record that I need to have a monthly snapshot of. Is there a way to create a script that will automatically save a copy of the master every month as a new document with a title such as PO_Record_Mar_2015 or something that makes sense? 

I have attached a generic version of the document to help demonstrate what I'm looking for.
1
Add a comment...

Tobias Loefgren

Problem/Coding Help  - 
 
Is it possible to have a file that comes with the addon, just like any .gs or .html files? For example, I would like to have a CSV file that my script can load some stuff from, but I don't want to read from or write to the users drive. At the moment I can only think of getting the file from an external server, but I would rather just have it built into the add-on. Thanks!
1
Tobias Loefgren's profile photo
3 comments
 
If anyone finds this and has a similar question, you should also take a look at Steve Webster's answer on this post: https://plus.google.com/103847037353942896629/posts/4r7HNZFsMJD
Add a comment...

Giedrius Gatautis

Problem/Coding Help  - 
 
I know nothing about programming. Somebody has done a following code for me and I'm trying to modify it slightly. I need to delay "sendEmail" task by 48 hours or add that time to the "mail_date". I was advised to add

var mail_date_plus_2 = new Date(date.setDate(mail_date+2))

but then I get the error "ReferenceError: "date" is not defined. (line 26, file "Code"). Any help will be much appreciated. Here is the script:

function sendEmail() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var data_sheet = ss.getSheetByName('Sheet1');
var values = data_sheet.getRange(2, 1, data_sheet.getLastRow(), data_sheet.getLastColumn()).getValues();
var row = 2;
var current_time= new Date();
Logger.log('Current data and time is '+current_time)
for(var v in values) {
var mail_note = data_sheet.getRange(row, 1).getNote();
if(mail_note=='') {
var mail_date = values[v][5];
if(mail_date!='') {
if(current_time>mail_date) {
Logger.log(v+'>>Need to send mail at '+mail_date);
var name = values[v][2];
var email = values[v][4];
var form = values[v][1];
var htmlbody = RESERVATION_EMAIL_HTML;
var prefix = 'Dear '+name+', '+"<br/><br/>";
htmlbody = prefix + htmlbody
if(form=='Reservation') {MailApp.sendEmail({
to: email,
subject: EMAIL_SUBJECT,
htmlBody: htmlbody,
});
}
var cdate = new Date();
data_sheet.getRange(row, 1).setNote('Mail has been sent at '+cdate)
}
}
}
row++;
}
}
1
Alan Wells's profile photo
 
try this:

var mail_date = values[v][5];
var mail_date_plus_2 = new Date(mail_date.setDate(mail_date+2))
Add a comment...

Jennifer Jones

Problem/Coding Help  - 
 
Help please! I have a spreadsheet called "TimeCard." It has 2 sheets called "TimeCardEntry" and "TimeSheetRecord." I need to take the data on "TimeCardEntry" entered into J3, C3, A7:I7 and add that data to one row in the sheet called "TimeSheetRecord" A-K. As you can see, the columns from the first sheet do not match up with the columns from the second sheet. I have written (copied) script so far that will copy one row from the first sheet to the second sheet but everything is in the same column it started in. How to I get the cells assigned to the proper columns (not the same ones they started in) and still have the data fill the first available row instead of a set row on the second sheet?
1
Alan Wells's profile photoJennifer Jones's profile photo
16 comments
 
Thank you so much. That answers my question. Again, you are a life saver.
Add a comment...

Eric L.

Problem/Coding Help  - 
 
In my script I have the user login through through oAuth and I want to change the menus when the user has successfully logged in.

Should I be using doGet() for this? When I try I get an error that "getUI" is only available in the new version of google sheets. 
1
Riël Notermans's profile photoEric L.'s profile photo
2 comments
Eric L.
 
It's a script with a dialog to login to salesforce in sheets. I want to change the add-on menus to reflect pre and post login status. 
Add a comment...

Courtney Cregan

Problem/Coding Help  - 
 
Any idea why this script is adding a duplicate row when it moves to the new sheet?

Background: I'd like to move a row from the sheet "Content Pipeline" to the "Client Ready" sheet when "Yes" is entered in column F. I don't want to delete the row from the original sheet, "Content Pipeline."

function onEdit()
{
// moves a row from a sheet to another when a magic value is entered in a column
// adjust the following variables to fit your needs
// see https://productforums.google.com/d/topic/docs/ehoCZjFPBao/discussion
var sheetNameToWatch = "Content Pipeline";
var columnNumberToWatch = 6; // column A = 1, B = 2, etc.
var valueToWatch = "Yes";
var sheetNameToMoveTheRowTo = "Client Ready";

var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = SpreadsheetApp.getActiveSheet();
var range = sheet.getActiveCell();

if (sheet.getName() == sheetNameToWatch && range.getColumn() == columnNumberToWatch && range.getValue() == valueToWatch) {
var targetSheet = ss.getSheetByName(sheetNameToMoveTheRowTo);
var targetRange = targetSheet.getRange(targetSheet.getLastRow() + 1, 1);
sheet.getRange(range.getRow(), 1, 1, sheet.getLastColumn()).copyTo(targetRange);
}
}
2
Viktor Gnat's profile photoCourtney Cregan's profile photo
3 comments
 
+Viktor Gnat Oh my gosh I love you. Thank you!!!! :)
Add a comment...

Carl Mason

Problem/Coding Help  - 
 
I have had a HTML web app running for the last 6 months with out any issues, starting last Friday we started to see the "Uncaught TypeError: Cannot read property 'match' of undefined" & "Uncaught TypeError: (1 , $) is not a function" & "Uncaught TypeError: Cannot read property 'ui' of undefined" in the console logs

Has anyone every experienced this error before if so can you please point me in the right direction on how to fix / resolve.

Thank you in advance :)
1
Carl Mason's profile photoSteve Webster's profile photo
3 comments
 
+Carl Mason You are welcome. Here is the SUNSET webpage I referred to. Please read because NATIVE will eventually be replaced with IFRAME, too. :)
https://developers.google.com/apps-script/sunset
Add a comment...

Pauline Grange

Problem/Coding Help  - 
 
Does anyone knows the answer about this question? Thanks.
1
Pauline Grange's profile photoLenny Cunningham's profile photo
13 comments
 
Solved my issue with this by setting SandboxMode to iFrame. Originally wasn't setting a SandboxMode at all.
Add a comment...

Martin Dimitrov

Problem/Coding Help  - 
 
Hello community! Does anyone experience problems with published spreadsheet add-ons on initial load? Our users report problems loading the add-on and I see the following errors in the JS console (see the screenshot). We experience this since the end of last week. Thank you.
4
Steve Webster's profile photoMartin Dimitrov's profile photo
9 comments
 
+Steve Webster, the default is IFRAME for new scripts. Quite complicated rules :)
Add a comment...