Status Update
Comments
tf...@linaveo.com <tf...@linaveo.com> #2
Since yesterday (2021-06-01), I'm able to deploy in test mode Google Sheets Add-on.
(Icon on right side panel is now visible => it was not the case before except for Google Doc)
=> it means fix was rolled out. (
... but this time, impossible to access to SpreadsheetApp.getActiveSpreadsheet() => null.
Same thing with PropertiesService.getDocumentProperties() => null.
it works fine with DocumentApp.getActiveDocument() (when add-on is opened on Google Document of course).
it works fine on another workplace domain (only my customer's domain is impacted)
st...@adair.app <st...@adair.app> #3
This is the same behavior I described here
Someone with the appropriate permissions should link both tickets.
mi...@google.com <mi...@google.com> #4
Hello there!
I could not reproduce this.
I tried reproducing, using this code in a Sheets add-on:
appsscript.json:
{
"timeZone": "America/New_York",
"dependencies": {},
"exceptionLogging": "STACKDRIVER",
"oauthScopes": [
"https://www.googleapis.com/auth/spreadsheets.currentonly"
],
"runtimeVersion": "V8",
"addOns": {
"common": {
"name": "Translate",
"logoUrl": "https://www.gstatic.com/images/branding/product/1x/translate_24dp.png",
"layoutProperties": {
"primaryColor": "#2772ed"
},
"homepageTrigger": {
"runFunction": "createCard"
}
},
"sheets" : {}
}
}
Code.gs:
function createCard() {
var fromSection = CardService.newCardSection()
.addWidget(CardService.newButtonSet()
.addButton(CardService.newTextButton()
.setText('Get active spreadsheet')
.setOnClickAction(CardService.newAction().setFunctionName('getSpreadsheet'))
.setDisabled(false)))
var builder = CardService.newCardBuilder();
builder.addSection(fromSection);
return builder.build();
}
function getSpreadsheet() {
const ss = SpreadsheetApp.getActiveSpreadsheet();
console.log(ss.getActiveSheet().getName());
}
When getSpreadsheet
gets called from the Card, SpreadsheetApp.getActiveSpreadsheet();
returns the spreadsheet as expected.
Can you please provide a set of reproduction steps for this?
Kind regards.
tf...@linaveo.com <tf...@linaveo.com> #5
Thank you for your code example.
I've just copied it into a new blank script. (json + code)
Changed nothing.
Create a test deployment. Install addon (see screenshot)
And then create a new blank sheet.
But...
SpreadsheetApp.getActiveSpreadsheet() is returning NULL, exactly as my other cases.
On my customer's domain : NOK
On my domain : OK
Thanks for your help !
Thierry
ro...@gmail.com <ro...@gmail.com> #6
tf...@linaveo.com <tf...@linaveo.com> #7
I can confirm my customer's domain is in Scheduled Release track.
My customer was impacted by issue
Now, this issue seems to be ok, but SpreadsheetApp.getActiveSpreadsheet() returns NULL
My domain is in Rapid release.
But I was not impacted by the issue
Everything runs smoothly.
mi...@google.com <mi...@google.com> #8
I have been able to reproduce this behavior and I have reported it internally. Please note that this affects other "active" methods (e.g. getActive()
, getActiveRange()
, getSelection()
).
Any updates about this will be communicated here.
Thank you.
tf...@linaveo.com <tf...@linaveo.com> #9
Thanks for your support.
FYI, It also affects PropertiesServices.getDocumentProperties()
Returning null as well.
This is quite logical, since the active sheet is not available.
Thanks!
jh...@longhill.org <jh...@longhill.org> #10
Also big thanks to the above commenter for providing more information regarding this bug, I wasn't around to do so.
jh...@longhill.org <jh...@longhill.org> #11
Looks like the issue is resolved for my domain.
Thank you!
tf...@linaveo.com <tf...@linaveo.com> #12
Thank you very much !!
mu...@google.com <mu...@google.com> #13
Hello there,
Thank you everyone for the patience regarding this matter. This has now been fixed.
Best regards
Description
SpreadsheetApp.getActiveSpreadsheet() returns null when called via Google Workspace Addon deployed via Google Sheets.
If deployed to Google Docs, DocApp.getActiveDocument() functions as intended.
You can reproduce this by creating a card with a singular button that calls
"SpreadsheetApp.getActiveSpreadsheet()"
or run that same line of code however you see fit to reproduce.