I know my question sounds a bit mouthful, so just let me make my point clear: I need to do something like bringing data from Google Sheet to AWS (i.e. Athena), or vice versa.
However, because Google API is in need anyway, I surprisingly found that require() is not even a function in such kind of JS' twin-like language at all. Therefore, how can we use any third-party libraries on it?
Example (github repo):
const {google} = require('googleapis');
You can use Gmail, Calendar, Drive, and most other Google Workspaces APIs in Apps Script by enabling Advanced Services.
Open the Apps Script project.
At the left, click Editor code.
At the left, next to Services, click Add a service add.
Select an advanced Google service and click Add.
Here's an example on how to use the Drive API inside Apps Script.
Related
I'm trying to set a filter to a GSheet with appscript but when I try to run the script appears a popup with:
Google Sheets API has not been used in project blackbox-6831xxxxxxxxx5 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/sheets.googleapis.com/overview?project=blackbox-6834xxxxxxxxxx5 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.
When I try to reach that link the console returns me:
The API "sheets.googleapis.com" doesn't exist or you don't have permission to access it
All the other scripts that interact with GSheet API works perfectly.
I have problems only with:
Sheets.Spreadsheets.batchUpdate({'requests': [request]}, ss.getId());
P.S.
I'm the admin
If you don't access directly to the URL, how about going to API console from the script editor and enabling Sheets API? The flow is as follows. Even if you tried this, when the same error occurs, there may be other problem.
Enable Sheets API v4 at API console
On script editor
Resources -> Cloud Platform project
View API console
At Getting started, click Enable APIs and get credentials like keys.
At left side, click Library.
At Search for APIs & services, input "sheets". And click Google Sheets API.
Click Enable button.
If API has already been enabled, please don't turn off.
And then, please confirm whether Sheets API is enabled at Advanced Google Services again.
Enable Sheets API v4 at Advanced Google Services
On script editor
Resources -> Advanced Google Services
Turn on Google Sheets API v4
If this was not useful for you, I'm sorry.
I have a chrome packaged app which saves files with the chrome.syncFileSystem api.
Now I want to develop a web app and fetch these files from the web. Is there a way to do this.
Thanks.
You can use the Google Drive API to access your Google drive, and you will find the files there. You can discover the location empirically, but, as it is not documented, it could change at any time. Google and others (e.g., Apple) have a habit of moving formerly-easily-visible files into obfuscated places.
To get you started, simply access your Google drive with their UI (web page or Chrome app), and you'll find the synced files. You may have to hunt around a bit with the links on the left of the Google drive web page.
I've been able to test this to a certain extent within our application, however I'm still testing the waters with google analytics to see if it is the best choice for app analytics; for externally embedded javascript.
I'm able to fire custom events, and custom page views. However I'd like to see all online users across all sites that have the widget embedded on. It currently shows online users, but it uses a relative URL path, instead of the domain or full path.
The type of data points I'm hoping to gather are specific interactions the user makes with the application, as well as live statistics which can be drilled down to the publisher of the embed.
Has anyone had experience using google analytics for third party embeds? or is there another service out there that is better suited for app analytics of this nature?
I would like to create a Web App for device. For that I would have some script being stored on device, instead of downloading them all time when I start application. As far as I saw including a GoogleMaps API makes some additional request for javascript files. Is there any way of having all of them taken directly from local store? Or is this always have to refeer to google web address? Thanks for any answers here!
No, you always must load them from the Google site. They offer no way to run Google Maps locally. The GMaps scripts are generated on the fly, based upon (among others, I'm sure) the HTTP_REFERER header of the request. That's how they can bind an API key to a specific website.
I'm developing a Firefox extension and would like to track its use with google analytics, but I can't get it working.
I've tried manually calling a function from ga.js, but that didn't work for some reason. No error was produced, but neither was any data collected.
My last attempt was to have a website that just holds the tracking javascript and then load it within the extension in an iframe with the URL configured so it contains meaningful data. This way the analytics are getting connected when I visit said webpage with a browser, but not in an extension. I've tried putting some visible javascript on the site and have confirmed the site's javascript is executing. This method also works with other trackers, but I don't like their output and would prefer Google Analytics.
Any ideas what else I could try to accomplish this?
The solution is to use Remy Sharp's mini library for tracking bookmarklets and extensions with Google Analytics. Works like a charm.
Usage is as simple as:
gaTrack('UA-123456', 'yoursite.com', '/js/script.js');
Note that, since it doesn't use cookies, there's no differentiation between pageviews and visits, or for that matter, between visits and visitors. But, the rest of the functionality is fairly reliable.
Depending on what you want to track you may not need Google Analytics. Mozilla's addon.mozilla.org portal already provides comprehensive tracking and usage statistics for addons.
To check if Mozilla provides what you need go to the Statistics Dashboard and choose the statistics for one of the publicly available addons.
Here is a small library to proxy the requests through an iframe hosted on another server: https://github.com/yelloroadie/google_analytics_proxy
This gets around the bug in the add-on sdk that causes ga.js to die (https://bugzilla.mozilla.org/show_bug.cgi?id=785914).
This method allows full use of google analytics, unlike the limited use found in the library by Remy Sharp.
I don't think this is possible. Firefox extensions don't allow you to load pages from other servers. So the only way I can think of is to have an invisible iframe load up the code. The pings to Google's servers need to be from a domain belonging to you. So I guess your own servers have to serve up pages every time a user loads the extension, which just kills your server and defeats the purpose of Google doing all the work!! Please post if you have found a way around it. Chrome extensions can be tracked easily!
For using analytics in the main/background script you might want to use this solution:
https://stackoverflow.com/a/17430194/193017
Citing part of the answer:
I would suggest you take a look at the new Measurement Protocol in Universal Analytics:
https://developers.google.com/analytics/devguides/collection/protocol/v1/
This allows you to use XHR POST to simply send GA events directly.
This will coexist much better with Firefox extensions.
The code would look something like this: