Regarding different effect of 'has:purple-***' in Gmail and AppScript - google-apps-script

Hi Gmail AppScript Experts,
Suppose we want to search threads in inbox marked 'purple-question'.
The query I wrote was 'in:inbox has:purple-question'.
When I input this in search field of my Gmail, it works and those threads will be displayed.
However, when I use Gmail AppScript, I wrote code like this:
var threads = GmailApp.search('in:inbox has:purple-question');
yet nothing was returned, which is different from above.
I assue the behavior should be same, however it's not. Does anyone knows why it's like this? Or it's simply a Gmail AppScript bug?
Many thanks in advance.

This a long standing issue (1191) that is marked as "won't fix". But this does not really seem like an Apps Script issue, the public Gmail API does not work with stars either (I have just tested it).

Related

Why do my Google Sheet custom functions require this weird workaround?

I’m creating custom functions in Google Sheets using their google apps script language. I’ve done my development on a laptop and it seems to work correctly.
However, when I open the sheet on my mobile device (iOS), the cell output for my custom functions get stuck at “Loading…” forever and never load. But I discovered this weird workaround, but I don’t know why it works or if there’s a better way: if I make a small, trivial change to one of the input cells, then close the sheet and reopen, the sheet will be correctly updated.
Note that if I just make a change to a cell, or add/delete a column etc, without closing and reopening, to force an update, it will still get stuck at “Loading…”.
Also note that if I close and reopen the sheet without making any change, it will still get stuck.
Any ideas of what’s going on here, and if there’s a better way to get my custom functions to correctly update without timing out?
I searched online for solutions, couldn’t find anything.
Update: Example sheet located at this link:
https://docs.google.com/spreadsheets/d/12nm9EwuzqaN0jYUv75CquMhrcUGlVsmEPFoWd92yuWo/edit
Look at the “SeasonTest” tab, cell AS5. On a mobile device it always shows “Loading…” (unless the above workaround is used), but works fine on a desktop

“Undefined” “#NAME?” Coding

I was making a Google sheets and need to use apps script to make Google write down the numbers in words.
Everything is fine except for the fact that before that amount in letters keeps showing “undefined” or “#NAME?”
I checked the code but is seems fine.
Please help, I could not find what is wrong with it.
enter image description here

Google Apps Script doesn't show the methods when coding

Firstly, let me say that I am Spanish so my English is not so good, so please be patient if you find it difficult to understand what I am to say.
Having said that, the problem I have when using Google Apps Script is that the kind of window that is being opened when coding isn't work.
For instance: If I type.... var doc = documentapp. nothing happens, that is, the kind of windows that shows the different methods doesn't even try to open, nothing happens
To help you understand the problem I have, I attached a picture with "what should happen" when coding...
I am in despair.. I don't know what is happening.
If you see the picture, when docfile. is typed a windows is open with different methods, like GetEditors and so on..
Well, that the problem I have, that doesn't happen to me when typing code.
Google Apps Script doesn't show the methods when coding
This is an auxiliary feature indicating you that something is not correct in your code
In your particular case: You misspelled DocumentApp (case sensitivity is important in Apps Script, so documentapp is wrong)
After you fix the typing mistake, the methods will be shown correctly after the . - unless you have some other mistake somewhere else in your code

Possible to pre-assign user to google form?

I am creating a Google Form dynamically, and emailing it, using Google Apps Script.
I have all the users info, and have figured out how to record the response. However, I would like to add that person's email to the row in the sheet.
It would be ideal if there was a way, since we already collected their email, to pass this email in the "background" to the form we send, and it is attached with there answer in the responses sheet.
Thanks!
I was not able to rest until I got this worked out. This article from almost three years ago really helped.
Not exactly what I was going for, still open if anyone knows how to actually pass info in the background to a sheet.
var items = formName.getItems();
var itemOfInterest;
for(var i in items){
if(items[i].getTitle()=='QUESTION_TITLE'){
itemOfInterest=items[i];
}
}
var preFilledUrl =
schedForm.createResponse().
withItemResponse(itemOfInterest.asTextItem().createResponse(email)).
toPrefilledUrl();
This prefills that question box, so also giving the user the ability to edit before they send. It'll work.

google.maps.places.Autocomplete does not return some correct establishment addresses

The Google places (google.maps.places.Autocomplete) class that is available to use by linking an input box into a drop down list to display addresses from is causing me trouble when searching for establishments
I can generate this issue on the Google example page as well at:
google places example
I use this feature in my code much like the example above by including a reference to the places API:
<script src="//maps.googleapis.com/maps/api/js?sensor=false&libraries=places"
type="text/javascript"></script>
The problem seems to be mainly around [Establishments]. But not just any establishments. It only occurs on some now and again.
The one I have particular issue with at the moment is when I type in the Name United campervan rentals, and select the resulting drop-down. The address that is returned in the autocomplete.getPlace() command is not address I would expect. The address returned is the middle of the bounds set when creating the autocomplete object.
However as per maps.google.co.nz, I an expecting an address of 3 Kingsford Smith Place.
I've tried it in a number of browsers including IE 8, 9, Chrome, FF 3.6. All produce the same result. I've also tried at different times of the day and the same result.
I had posted this on the Google API forum but read an article that they are moving their Q&A to SO, so as long as I add the appropriate tags someone may be able to offer some sort of insight. I'm really hoping this is the case. Cheers.
For anyone who reads this I logged an issue on the gmaps API issue site and after a few days the issue was cleared as fixed. This also resolved the question.