I have a published google spreadsheet and would like it to download as a specific file name when I download it as a TSV. The name of the file when downloaded is the name of my sheet + - Template.tsv. I need a way of changing this setting on the google end because this file will be downloaded via an HTML form, so I won't have the option to manually change the file name.
Related
I am making a Google Apps Script 'Docs' add-in.
I have the following code:
return {
name: DocumentApp.getActiveDocument().getAs('application/pdf').getName(),
base64: Utilities.base64Encode(DocumentApp.getActiveDocument().getAs('application/pdf').getBytes())
}
The getActiveDocument() method is forbidden returning this:
Exception: The document is inaccessible. Please try again later. [line: 130, function: getPDF, file: Code]
This is because google docs works with google doc files and not .docx files.
How could I convert the .docx file I have in Docs to a .pdf file?
Note: copying the file and deleting the previous one is not an option.
Note: I want to do it within the app (in the code). Not manually :)
Open your docx document in MS Word 2013.
2Click on the File tab and select Save as.
3Choose the folder where you want to save the file. In the drop-down menu Save as type, choose PDF. Click the Save button and your docx file will be saved in PDF.
Is there a way to extract data from google sheet's work sheet, to a specific dropbox folder, in CSV format? Additionally, previously created CSV file must be re-written / replaced whenever new data is added to work sheet. Basically, I need a one-way sync from sheet to a CSV file in a dropbox folder.
Google Drive Screenshot
I have one Video file in my Google Drive with the name Perfect.mp4 and I have created a direct download link of this file with Google Drive API. So User can Download this File Without this Warning ( Google Drive can't scan this file for viruses ) but the problem is
when any user downloads this my video file: Perfect.mp4.
Then The name of my video is automatically renamed with the FIELD ID and the file extension is also gone.
This is My Link: https://www.googleapis.com/drive/v3/files/1nRLV1rEcQddkWJ6nGCCdsCvemSp_mqza?alt=media&key=AIzaSyCj8FQUm-Su55PRIQbTZ2BHc9gY8BDr4vE
The filename of my video is correct in my Google Drive account but When Any User Downloads my video file with this link then only The name of my video is automatically renamed with the FIELD ID and the user sees any random file id name instead of my original file name.
Please help me to solve this problem
You should use the webContentLink:
https://drive.google.com/uc?id=1nRLV1rEcQddkWJ6nGCCdsCvemSp_mqza&export=download.
It is not a good idea to share your API key.
How can I open a apps script script file, copy its contents and then replace the contents of another apps script script file in the same account with the copied contents?
What I have so far:
// open file to copy from
var file = DriveApp.getFileById(fileIdToCopyFrom);
// copy file contents?
var copiedContents = file.getAs('text/plain'); // generates error: Converting from application/vnd.google-apps.script to application/pdf is not supported.
// replace file contents with copied content
DriveApp.getFileById(fileIdToCopyTo).setContent(copiedContents);
Take a look at Importing and Exporting Projects
You are on the right path using Google Drive, but you need to use the API as described in the documentation.
The key is getting the file data as JSON using the exportLinks this ifo can be pushed into another apps script file.
Also keep in mind that MIME type is application/vnd.google-apps.script
I am trying to modify the following script, which saves a selected range to a new CSV file on Google drive.
https://developers.google.com/apps-script/articles/docslist_tutorial?hl=en
Please see: Section 3: Saving a selected Range to a CSV file
I would like to however append an existing CSV file with defined (named) range that I already created on Google Drive - I don't want to be prompted for its name. If and only if the CSV file not exist, then I want to create the new file.
This script should run via time-drive trigger (so that it runs automatically every minute and saves required range into csv file)
I would greatly appreciate your help how to modify this code.