The google sheets API documentation states I need to have a sheetID that would show up in the url here (denoted {SHEETID}):
https://docs.google.com/spreadsheets/d/{SHEETID}/edit#gid=0
However, when I publish to the web, the URL returned is something along the lines of:
https://docs.google.com/spreadsheets/u/1/d/e/2PACX-1vcasfsaf2123Mt_basdf34grGd_1231sfak_D32141sfasfqwer_phealsjsmfdafcmr2S_-n-wzUp/pubhtml
I have also already tried just using the sheetID from the unpublished url and that does not work either.
I'm trying to pull data with react from this sheet but am unable to do so. Does anyone know how else I can get the sheetID?
Related
I am working on a Covid-19 Tracker Project which requires me to get and use api data through the URL https://thevirustracker.com/free-api?global=stats recommended on the website https://thevirustracker.com/api but for some reason I can neither access the suggested website nor can I get the required data through the suggested URL.
Instead I'm trying to do it through https://corona.lmao.ninja/v2/all?yesterday but the result has a slightly different structure and therefore I'm finding it hard to code in line 48 of my GlobalData.js file on Visual Studio in order to display the "cases" figure of the result of the api GET request under the "Global Data as of Today" in the first Paper section of the app.
Can someone please help me out?
Pic Result of api GET request
Pic GlobalData.js
Fetch api sends always you a promise so in console you can see that is a promise.
try this you will get your actual data in console.
fetch('https://corona.lmao.ninja/v2/all?yesterday')
.then((res)=>res.json())
.then((data)=>console.log(data))
.catch((err)=>console.log(err))
Request:
I need to Connect a Service using JS with a Private Google Sheet. It's not needed to get the end user to sign in into a Google Account, I only need to show some data from that Private Google Sheet into the Web page.
I already have a Key and a Client ID which I use following these steps https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/get
It works so far, the issue that I have with my request is that this sample get the end user to sign in into a Google account to then make the Api Call.
NOTE: if the Google Sheet is Shareable by a link then I can connect with the Key, however the Google Sheet should be private to only grant access to some people.
Is there a way to only consume the data from the Private Google Sheet without to get the end user sign in into the Google Account?
As suggested in the comments, you can use a Web App as an API to make a get or post request from your JavaScript application, in order to not need credentials/token for those requests you need to deploy the web app with the option "who has acces to the app" set to "anyone, even anonymous" and the option "Execute as" set to "me" so it can be run under your credentials. An example of a simple web app to which you can do a get request to the deployed url is below:
function doGet() {
var spreadsheet = SpreadsheetApp.openById("[SPREADSHEET-ID]");
var sheet = spreadsheet.getSheetByName("Sheet1");
var values = sheet.getRange("A2:E6").getValues();
var stringOutput = values.toString();
return ContentService.createTextOutput(stringOutput);
}
This will retrieve the values from the "A2:E6" range as a string.
I am in the process of creating an app using the Google Maps api to generate random biking routes (http://sutsurikeru.com/maps) and it works fine so far, but the issue I am having is passing the generated route, including the following info to the google maps app:
Start Destination
Way-point (randomly generated using https://gis.stackexchange.com/questions/25877/how-to-generate-random-locations-nearby-my-location)
End Destination (same as the start destination)
Once I've got all the lat/long information I pass it to a button that is created when the route is generated so that it can pass the route to the Google Maps App, but I am unsure how to pass the way-point as there is no mention of it in the docs - https://developers.google.com/maps/documentation/ios-sdk/urlscheme
$('#goRide').append('<a class="goridebtn" href="comgooglemaps://?saddr=' + address + '&daddr=' + address + '&directionsmode=bicycling">Go ride</a>');
I guess my question is then, can I include the way-point information when I am passing it to the Google Maps App?
i couldn't find the answer for that too , so i ended using:
"comgooglemapsurl" instead..
this way you can pass a full url (same onese used in the browser)
the format will be something like this:
comgooglemapsurl://www.google.com/maps/dir/STARTING_POINT/WAYPOINT_1/WAYPOINT_2/WAYPOINT_3/WAYPOINT_4/DESTINATION
you can add as many points as u wish
comgooglemapsurl://www.google.com/maps/dir/24.848607,46.660478/24.748607,46.760478/24.778607,46.784478
https://developers.google.com/maps/documentation/urls/ios-urlscheme
Looks like you can add waypoints using the +to: variable inside the daddr text. The following example shows this in use:
comgooglemapsurl://?saddr=55.852866,-4.323120&daddr=56.019015,-3.372803+to:55.972934,-3.279419+to:55.932952,-3.284912+to:56.022085,-3.565063
I am trying to create a freebase acre application which can keep track of certain users records and export the mql query output to Google Docs.
Is it possible to export mql query output to Google Docs in acre?
Edit #1
I found out this doc by which i can export data to Google Docs using javascript.
Edit #2
I am able to upload files to drive but i need to create a Spreadsheet with it. Could it be possible?
This is possible using Google Drive SDK. I am successful in exporting the query output but not able to share the code here.
If you can export the results as CSV, you can create a Google Spreadsheet with them. The important point is to remember to set:
convert=true
Query parameter on insertion which will ensure that your file is converted correctly to a GOogle Spreadsheet.
I've been trying to add a buffer function into an ongoing project that uses the arcgis server link for google maps here.
I am able to draw the buffer out on the map, however, when I try to implement the query for the buffer (With proxy.ashx) and all, the proxy loads okay according to firebug, but they returns an error, "Error: Error Code 0" and nothing else. I am kinda stuck now because of this.
I am not sure if I did the proxy config file wrong or is it the codes. I am currently using the layer's query from the link above as an reference on how to query via a buffer, by indicating a spatial filter which is the buffer itself.
Here are the codes:
var layer = overlayObjects['ls'].getMapService().getLayer(0);
var params = {
geometry: buffers,
geometryType: "esriGeometryPolygon",
where:" ",
spatialRelationship: "CONTAINS",
returnGeometry: true
};
layer.query(params, function(resultSet){...}
The error occurs at the layer.query() method.
My proxy config file:
<ProxyConfig mustMatch="true">
<serverUrls>
<!-- serverUrl options:
url = location of the ArcGIS Server, either specific URL or stem
matchAll = true to forward any request beginning with the url
token = (optional) token to include for secured service
dynamicToken = if true, gets token dynamically with username and
password stored in web.config file's appSettings section.
-->
<serverUrl url="http://*mapserverlink*/ArcGIS/rest/services/"
matchAll="true"></serverUrl>
</serverUrls>
</ProxyConfig>
Due to some security reasons, I am not sure if I should place the server url here. Regardless, the serverUrl is not secured, so I do not think a token is necessary.
Also.. Is it because the buffers object I used not an overlayView object? As stated in the queryOptions class reference. My buffering is mostly the same as the one in the examples in the link above. I have tested using the Geometry I got from the buffer and place it into the mapserver's query service, and received an array of records back, but not for the javascript.
Any help with this would be appreciated..
Sorry about placing google maps api v3 in, as I thought it is included on the api reference I am looking at. I've managed to figure out what's wrong with the error code 0. I've read through the arcgislink.js that is in the project and saw that the code 0 comes from a status code from the XMLHTTPRequest. After some configurations with the server, its working now..