Downloading files from google storage using Google Scripts - javascript

I'm trying to download the .csv of my app reviews on the play store and import it into google sheets using Google Scripts.
Is there a way to access google storage with Google scripts?
I want to retrieve the files from my bucket
Eg) gs://pubsite_prod_rev_0123456789/reviews/reviews_com.example.app_2013*

If the object is publicly readable, you can import it like any other URL:
IMPORTDATA("http://storage.googleapis.com/bucket_name/object_name")
The wildcard character, *, won't work, though. IMPORTDATA only accepts a single URL at a time.

Related

How to Hide Google API Key And Still Use It

I am currently hosting a website on GitHub. I want to be able to use the Google Sheets API to read data from a google spreadsheet in node js. Is it a security risk to push code with the API key? Is there a way to hide it on GitHub but still be able to use it?
Use this module https://www.npmjs.com/package/dotenv
Set you API key in a .env file something like this
API=sds1sdf13s21f23sd1fs1d3f21
and access it via process.env.API
and add the .env file to the .gitignore

Automating Google Sheet actions (Make a copy, Google App Script, Triggers) via Drive API

Under the same account, we create client Google Sheets from a template we store within Google Drive.
On a regular basis, we make a take a few actions and make changes to the Sheets. These include:
File-Make a Copy
Rename Sheet and move to the "Client" folder
Make small edits to a few lines in Google App Script within the
Sheet
Setup 3 triggers with permissions to execute on change, edit etc
Takes around 3-4 minutes but we do quite a few per day.
Can these actions be automated via Drive API or perhaps Google Cloud Functions? The project runs alongside AWS Lambda, so that is also an option too as we have used gspread before to work remotely with Sheets. But as far as I am aware making copies, triggers and app script are not available via API or other means.
But as far as I am aware making copies, triggers and app script are not available via API or other means.
You can do all that and more just using Apps Script. Read through the guides provided as part of documentation:
https://developers.google.com/apps-script/overview

Is there a way to use Google Drive with JavaScript without Google Cloud Console?

I'm looking for a way to use Google Drive to share data between a Android app and a web page hosted on my server. The web page should use JavaScript to retrieve and store data in Google Drive.
The data should only be exchanged between the browser of the user and Google Drive.
According to the documentation of accessing Google Drive from JavaScript you must first create a application using the Google Cloud Console, register it and get a client ID before you can use JavaScript to access the data.
I don't want to have to maintain a Google hosted application. Is this possible?
The only point of apis console is to register your applicaiton or in your case script with google. Its baslcy just there way of keeping track of whos accessing what i think. Once you have it registered you normaly would use a clientid and stuff as well as Oauth2 to allow users to access there google drive with your script. But you wont need to go into that becouse its your application thats storing its data there and not a user.
You will probably want to look into a service account.
https://google-developers.appspot.com/drive/service-accounts
If you want to use private spreadsheet then you have to use authentication, in this case google project is easiest one. If you don't want to use private then you can publish your spreadsheet and then make ajax call without authentication/goole project.
You're not the first person we've heard this complaint from. People want to be able to log in and create an API key without having to deal with extraneous cloud services. We're working on some things to make life easier for customers like you.
Unfortunately there is no way to do this at the present time. That said, you don't have to actually maintain a separate application. You can create a project and only use it to manage APIs.

Using Google drive to store apps data in structured format- similar to dropbox datastore API

I am working on an app and want to store user's data in user's google-Drive.
After looking at dropbox datastore api I would like to use something similar to store structured data as dropbox does.
Is it possible to do with Google drive or its better to use Dropbox api in this case.
You can use the Drive Realtime API to store structured data that is automatically kept up to date.
Or, depending on your use can, the app data folder can be used to store configuration information that shouldn't be accessible to the user.

Google Drive API & Google Realtime API - Can I place a realtime file in the app folder?

Using the Google Drive API and Google Realtime API (via JavaScript):
I can create a realtime file without providing a parent. However when I attempt to set the parent as "appdata" I receive this error from the API:
Only folders or files with content stored in Drive are allowed within
the appdata folder
It's a little vague perhaps a realtime file is not considered having contents?
So my question: Is it possible to place a realtime file within the app folder?
Through further investigation I have managed to find the answer to my question.
Actually, unfortunately you cannot currently place a realtime file
within the appdata folder. This is something we are looking at
adding, but in most cases it doesn't make sense since the content of
the appdata folder is restricted to a single user.
Cheryl Simon on Google Drive Developers - https://plus.google.com/communities/107264319205603895037

Categories