We are using the 'Save to Drive' button (https://developers.google.com/drive/savetodrive) on our web site to allow clients to save CSV exports to Google Drive.
Unfortunately, this saves the file to the drive but doesn't automatically convert it to a Google Sheet. This means that users have to click 'Open with Google Drive Viewer' and then 'File > Open with Google Sheets’ to convert the file to a spreadsheet in Google Drive. This makes for a poor experience for our users.
Is there a way to ask Google Drive to automatically convert these documents on import? Also, if there is a better place to ask this question let me know. Thanks!
Related
Using the Google Drive API I can get a file's webViewLink to link to the file-preview in Drive, and the user can then select 'Open with Google Sheets' in the top bar to open the file up in Sheets.
Is there a way to skip that intermediary step, and link directly to that file in Google Sheets?
File.resource also contains a link called webViewLink
webViewLink string A link for opening the file in a relevant Google editor or viewer in a browser.
This will not work on all file types but it should work on sheets.
What are you seeing in webViewLink?
When I try, I get
"webViewLink": https://docs.google.com/spreadsheets/d/1egZQnArX7TOHlQWSHiba3TTNt9Y7JoqgDAIJMdM0MQ/edit?usp=drivesdk"
which directly opens the sheet.
So a couple of things:-
Are you sure that the file in question is a native Google spreadsheet, or is it, for example, an uploaded Excel
If your webViewLink is different, you could construct the URL yourself by setting your own file's ID after the /d/
What's an efficient way of making an offline backup of a Google spreadsheet so that it includes its Google script files? It seems that if I use the Download as Microsoft Excel File feature, the downloaded xlsx file does not include any Google script that is part of the spreadsheet.
I saw a post about a command line tool called "Clasp" by Google that can be used but I was hoping to use something that is not so arcane.
I often make spreadsheets in Google Sheets by importing a collection of csv files. But whenever I import a csv file into a Google Sheets document, the csv file is uploaded to my Google Drive as well.
As a result, I have a huge number of csv files in my Google Drive that I don't want.
Can I stop this from happening? I want to import the csv into the Google Sheets document but I don't also need the csv file in my Google Drive.
A follow-up question is: if I can't prevent the csv from being uploaded to my drive, can I delete the csv from my drive without affecting the Google Sheets document?
This question is related to this one How to stop Google Sheets automatically saving downloaded CSV files to Google Drive, but they asked the question incorrectly, and never followed up with a corrected question.
The CSV files being uploaded to the Google Drive is necessary. It is due to the fact that Google Sheets will only look for the source files to be imported either from your personal Google Drive or from other people's Google Drive that are shared with you.
Suggestion
As for your issue on multiple csv files, you can create a script to automatically delete csv files from your Google Drive. However, the only available feature in Google Apps Script is to move the said files to a folder using the File.moveTo(destination) function since the removeFile(child) function was already deprecated. Afterwards, you may use the setTrashed(trashed) function to send the files to the trash folder.
References:
You may view the following links for further details on how to apply the suggestion.
removeFile(child)
moveTo(destination)
setTrashed(trashed)
Google Apps Script Deleting Google Drive Files in Folder Example
I have a bunch of screenshots (probably in thousands) that I want to run OCR on. I tried different services but Google Drive results are far better. But the process is a little tedious. First I have to upload a photo to Google Drive and then right click the uploaded file and select "Open with -> Google Docs". The resultant doc file contains all the text that was in the screenshot. However, it works for only one file at a time.
So is there a way to tell Google Drive to automatically create the doc file for every photo at the time I upload them.
I know there is Google Drive API that could help in this regard but I have very limited experience with coding and API. I could use a program if available.
I am uploading Word documents to Google Drive using the Google SDK. I can view these files once uploaded through the Google Drive interface, but to edit these documents I need to selected "Open with Google Docs". When I do this, Google makes another version of the file and saves it to my Google Drive.
I want to automatically create a URL for users to click on once their file has been uploaded, so I presume I somehow need to convert the uploaded file (Word Document) to a Google Docs file so a user can then edit it and save it. Is this possible?
You need to send the optional query parameter of convert
convert (boolean) Whether to convert this file to the corresponding
Google Docs format. (Default: false)
Documentation for Google Drive Insert