问题
I have just made an addon for Google docs, successfully tested it and now I would like to use it. It's very simple, it just shows the id of the current document.
This is the most important part of the script, just called by the onOpen(e) function:
DocumentApp.getUi().alert(DocumentApp.getActiveDocument().getId())
When I tested it by the Publish/Test as addon (I am not sure with English titles, I translated the button names from Czech) it works exactly as I want.
How can I use it the same was as I would download it from the webstore? I don't want to publish it, because it isn't much useful for others and I would have to follow the rules, wich Google wants. Is it possible?
回答1:
You can publish it privately. This way you can publish it instantly (google doesn't need to review it), it's only visible and install-able by you, and you don't have to pay the developer fee.
回答2:
In the Chrome Web Store developer Dashboard:
Developer Dashboard
You can add an "Item" to be published as a draft. Then, you can edit the item before publishing it. At the very bottom of the "Edit Item" page, there are 3 settings for visibility options. The last one is "Private"
An Apps Script bound to a Doc runs the onOpen() function without publishing the script as an Add-on, or Deploying the bound script as a web app. Publishing an Add-on, and deploying a web app are two totally different things. But, you don't even need to do either of those. All you need to do, is open the Doc that the Apps Script is bound to, and the onOpen() function will run. Also, you don't need the e argument in onOpen(e). That's for an event parameter.
Something else that's interesting is group based publishing:
Group-Based Publishing in the Chrome Web Store
回答3:
You can not by pass the payment process i suppose. As earlier comments mentioned; you can pay the developer fee (as i remember it was like a 5 dollars) and publish it as private. So nobody can see and install it. But if you want to use as test you can run the script as test on a document. Select the "Run->Test as add-on..." menu and you have to select a document. After selecting and openning that document you will see very long text on address bar like this:
https://docs.google.com/document/d/your_document_id/edit?addon_dry_run=bla_bla_bla
So just take the
?addon_dry_run=bla_bla_bla
part after the
https://docs.google.com/document/d/your_document_id/edit
and paste to your other documents :) Your add-on menu will work. But i can not guarantee if that works for only your account or a security leak! Use at your own risk.
来源:https://stackoverflow.com/questions/32332913/using-my-own-google-docs-addon-without-publishing-it