I want to print the Google script I have written (ultimately into a PDF) so I can send it to someone for them to look at.
I am unable to share the spreadsheet with them so I want to send it as another file but I don't want to lose the formatting. Not sure if this is possible but any help would be great. Thanks.
To export a static version of your code as displayed in the Apps Script Editor do the following: "Save Page As..." "Complete Webpage" on Chrome (other browsers will have corresponding method). Then share the resulting .htm file and folder. Delete all the .js files so that you don't get error messages. Done!
Here's an example folder you can download to see what the result looks like with javascript files deleted: https://drive.google.com/drive/folders/1eEhXJ7O7wc_uVzvzxIQ-ZpDnKA6HD_61?usp=sharing
Related
I'm wondering if there is a way to share a link to a Google Apps Script file that forces users to make a copy of it? Using Google Docs, you can append /copy to the url. For example:
https://docs.google.com/document/d/19yoQ71RcqNsYgPmZHzw96G_QH05hC20sWxk_ktahpXY/copy
This will force users to make a copy of the original document. I've been trying to do something similiar with a Google Apps Script file.
I've tried appending copy to the URL like this but it doesn't seem to work. As a potential work around, I could just use embedded scripts and share the Sheet/Doc/Form.
Anyone know of a URL parameter to force copying of a Google Apps Script file?
You can use this format to quickly make a copy of any public Google Script.
https://script.google.com/d/SCRIPT_ID/edit?newcopy=true
See example.
There is no way to do this since the new editor has been rolled, have reported it on this issue:
https://issuetracker.google.com/issues/198266388
You can manually make a copy on the new editor by going to the "Overview" tab, and on the top-right is the button to make a copy.
I know how to write script to make a copy of an active spreadsheet (with my script, the spreadsheet is actually open on my screen) and save the copy with a filename name I give it to the folder I specify.
This is nice, but the spreadsheet open on my screen remains the original. I would like to know how to write a script to do as I describe above and close the original and open the copy on my screen. That is, I want the script to act as Microsoft Word and many other programs act - when you're working on a file and then click "save as".
Thank you!!!
The only way that you could open the newly created spreadsheet file, would be to have some kind of HTML user interface (Dialog, Sidebar, HTML App) that used something like window.top.location.href = url to open the new spreadsheet. There is no way to open and close Google files from Apps Script server side code.
So I'm about to attempt to upload several files through a Google Chrome Extension.
Instead of pressing the Upload button on the webpage and load each file one by one I want to automate it.
How should I go about this? Is it as simple as detecting the script inside the DOM responsible with uploading, changing the file_to_upload string from the scipt with a filename on my computer and injecting the new script and execute it ?
I would like to build an application on a webpage, that does as google docs:
I want to build an app that allow people to work on a document in collaboration
I start with this: https://developers.google.com/drive/realtime/realtime-quickstart
But the problem is that it creates a file with the mimetype is "application/vnd.google-apps.drive-sdk".
I would like to work with google docs format, so people can open them with their google drive and edit their later.
The file created is not the proper format, and find it me impossible to open it.
( I try to edit the mimetype with "application/vnd.google-apps.document", however it creates the file in the google drive but it can't find the file when it try to load it).
How to create a google doc in realtime ? (If you can post the code here, it would help me a lot)
Then, it want to add the toolbar for editing(bold, italic,...).
After that, it would like to add the google picker to select the file to load.
I'm looking for a way to either:
a) replace "File" > "Download as..." > "Microsoft Excel (.xlsx)" in Google Spreadsheet in such a way that when I click on "Microsoft Excel (.xlsx)" it asks me for the name of the file that I want to save (i.e.: like a typical "Save as..." menu entry).
b) if it's not possible to replace the standard menu entry, I would like at least to add another menu entry in another menu which behaves like described above.
Even though I haven't been able to write a script that lets me replace an existing menu entry, I've managed to write a script that adds an additional menu.
Is it possible to accomplish "a"?
Another problem now is that I can't seem to find a way to replicate the behaviour of "File" > "Download as..." > "Microsoft Excel (.xlsx)".
I've found other posts in which it's described how to write Google Scripts in order to do something similar (e.g.: create a backup of a spreadsheet in Google Drive in a specific format, or send it via GMail to a specific address).
Actually, after reading "Can I download file from URL link generated by google apps script" I'm not even sure it's possible.
Note that you cannot download per se, since you have no access to your
PC's resources (e.g. file system) from apps-script. The file is still
in "the cloud"... in this case, it's been copied from the web site it
was on, into Google Drive. If you're running the Drive app, though,
the file will now sync to your PC.
Is there any way to do that?
Thanks in advance.
The only way I achieved download of a file from the spreadsheet is by writing completely separate script which accessed my original spreadsheet by document id, generated a file and downloaded it like this:
function doGet(){
var outputDocument = DocumentApp.create('Some csv');
var content = getCsv();
var textContent = ContentService.createTextOutput(content);
textContent.setMimeType(ContentService.MimeType.CSV);
textContent.downloadAsFile("4NocniMaraton.csv");
return textContent;
}
Then I had to publish the App and get a link for it. That link I placed in one of the sheets in the original spreadsheet, which I used as a data download link. Other then this I didn't find a way to work the security issues around.