Synchronising/Uploading a .csv file from Google Drive to Google Drive Bucket using Cloud Shell Commands - csv

I have a csv file in my google drive.
I'm trying to take it to a google cloud bucket using cloud shell commands.
Anyone can help please?!
Thanks ^-^

There is no a “direct” way to accomplish this, however, there are many workarounds to make this with some extra steps. You could even write and deploy a program on GAE or GCE to do this . But I think the easy way to do this would be download the file to your local machine (with Cloud SDK installed previously) and then upload it with gsutil command [1]:
Input into google cloud shell or your terminal if google cloud sdk is installed:
gsutil cp myfile.csv gs://my-bucket
[1] https://cloud.google.com/storage/docs/gsutil/commands/cp

Related

Can GoogleSheet write json to local folder in computer automatically by apps script?

I would like to write json files to the local computer( D://MyJsons ) by apps script.
(I've already wrote the code to get json string. I just need a way to write to the local folder)
I've found DriveApp.createFile to write to google drive, but not found a way to save in the local computer.
Is that possible?
Apps Script only work in the cloud, it has no access to your local storage. The best way to do it would probably to setup a synced folder between your computer / server and your drive.

How to run gcloud if Google Cloud SDK if my project is on another drive?

I'm building an API with Google Cloud functions and I had the same issue as the guy from this post: Could not load the default credentials? (Node.js Google Compute Engine tutorial)
When trying to use my API, I received this error:
Could not load the default credentials. Browse to https://developers.google.com/accounts/docs/application-default-credentials for more information.
So I went on and followed the steps suggested in the question I mentioned. I downloaded the gcloud SDK, installed it, and at the end of the installation wizard there is an option to run the google cloud cli immediately.
I ran it successfully and logged in properly, now any time I open the command prompt I can use the gcloud command without a problem.
Mi issue is the following. I'm running my commands in VSCode bash terminal and I get an error saying that the gcloud command is not found.
My project is in my D: drive, and the SDK is on C:, which I believe is the reason why the gcloud command is not recognized when I attempt to use it.
Should/can I install the Google Cloud SDK in my D: drive and use it there, or should I move my project to the C: drive?
I read somewhere that this might be a problem with the bash terminal, but I tried running it from command prompt in VSCode and I get the same error, so I guess it's got nothing to do with it.
Thank you for your time.

Accessing Google Drive files with command line in Linux

I would like to be able to upload/download files from my Google Drive using a command line in Linux. I found an application called gdrive but Google refuses to authenticate this program. Any suggestions?

Download Directory from Google Cloud Compute Engine

I am trying to download a full recursive directory from Google Cloud Platform using the trial edition of the platform. I assumed that the "Download File" option under the SSH dropdown settings would work, but it does not, providing only a "Failed" message on the window.
Upon trying to look up the answer, I found people mentioning downloading files from storage buckets and such - that is not what this is and to my knowledge I don't have access to those on a trial edition of GCP. I have a compute engine running and can SSH into it and I am looking to download a full recursive directory from it.
Thank you for any advice that you can offer me!
If you already have SSH access, you can use the scp command to copy files(assuming it is available on the system to which you want to copy the files).
scp -r username#server:/path/to/your/directory /local/destination
Another option is to use SFTP if scp is not available. Various clients are available for this for various operating systems.
Either of these options will transfer the files over SSH without any additional configuration required on the server(compute instance in your case).

Script to perform a local backup of files stored in Google drive

I am about to store all my critical files on Google Drive. Before doing this, I'd like to make sure I have a proper backup in case I delete accidentally files.
There are tools to perform backups / restore of Google Drive (e.g. backupify). However, I'd like to keep it simple and have a script running on my PC that let's say once a day takes a backup of files stored in Google Drive.
Does anyone has a script to perform this ? The script can be on PC or Mac.
Thanks a lot for your help !
Hugues
The easiest way to keep a local backup of your files would probably be to install the Google Drive application. There are versions for both PC and Mac:
http://support.google.com/drive/bin/answer.py?hl=en&answer=2374989
Jay