Google Sheets Automation and Real Time Graphing - javascript

My knowledge of Google Sheets is somewhat limited. I have recently been keeping track of daily stock quotes (using the GoogleFinance function) and I was wondering how to utilize Google Sheets script editor to make a more automated and real time graph.
For example, I have columns with the stock price and volume that are updated every so often. I wanted to be able to take the values in these cells as they update and plot them in real time (as a line graph). I know Google script editor on Google Sheets has the ability to trigger at a certain time, so I would like the graphs to start populating at 9AM (when the markets begin to open) and stop populating at 4PM. I figure that updating the graph every 5 or 10 minutes would best enable me to capture the changes.
I wanted to do this to look at the relationships between various metrics (like the fluctuations in price and volume over time). I do not know if Google Sheets is too limited to do something like this, but if you know of a way to do so, please do suggest it.
Thank you!

Well, I think you need to use Apps Script here to achieve this Automation. I found here a tutorial that show how to create an automatically updating spreadsheet. But, sadly to say it did not mention here on how to create graph. But it will give you an idea on how to create automatic updating spreadsheets. You can also check this Google Analytics Report Automation and this thread if it can help you in your case.

Related

Javascript and Google sheets interactions

I'm new in JavaScript and currently building a web apps that interact with Google Sheets as a database.
Basically what i'm building right now is to get input from users through Web apps and giving it to the Google Sheets (which have all the database & formulas in it).
Based on the input, Google sheets will then do the calculation and return back the value to JavaScript to be publish on the Web. (I do this because i want to make the Google Sheets data remain private). Due to the complex dataset, Google Sheet will take some time (around 3-5 seconds) before can pass the value to Javascripts (using SuccessHandler).
The code that i currently have is working ok. But i want to make the Web apps more interactive. What i means is that, during the data processing by the Google Sheets, i want to tell the user to 'hold on' and don't do anything yet. I try to use loader but I don't know how to trigger & to stop the loader (while waiting Google Sheets do the calculation process).
Would greatly appreciate if someone could help me in this problem.
thanks.
Most of the time retrieving data from somewhere else using JavaScript is an asynchronous process. As a result you're not blocking the user from performing actions to keep your site interactive.
The thing you're trying to achieve is keeping track of when your asynchronous data has been collected. This can be achieved with Promises and techniques like async ... await. Another option, though not recommended, is making your code synchronous, meaning the whole page get blocked while your retrieving data from Google Sheets. The pro is that a user can't do anything, the con is that if it takes too long it might look like the page stopped working (as it will literally freeze).
Explaining asynchronous JavaScript is a too in-depth topic to elaborate on here, but there are a lot of tutorials out there to get the hang of this. I'd suggest you dive into that.

IMPORTXML Google Sheets Query HTML

I'm using the IMPORTXML function on google sheets to import the latest visa numbers from the Canadian government however I can import everything on the web page apart from the data/numbers which I think could be down to JavaScript.
I simply just need to find a way to pull that data into the spreadsheet but I'm not experienced with JS.
Here's the website and here's my query:
=IMPORTXML("https://www.cic.gc.ca/english/work/iec/selections.asp?country=au&cat=wh",
"//div[#class='col-md-8']")
Here is an example sheet.
Unfortunately Google Sheet's formula IMPORTXML is only able to read the static HTML source of the page so it will not be able to read any dynamically inserted element (as you guessed the visa number is dynamically inserted with a Javascript script).
If you inspect in your browser the page source of this site, you will see that the numbers like Candidates in the pool are not there and therefore, IMPORTXML will not be able to reach them.
In order to get them you will need to look for another web scraping technique (with libraries like scrappy and so on).
I hope this has helped you. Let me know if you need anything else or if you did not understood something. :)

Equivalent to Excel Slicers for Web Applications?

Is there an equivalent of Excel's slicers for Web applications?
Context... This is meant to be used in a web dashboard.
Some background for anyone not familiar with Excel slicers... Excel slicers allow you to quickly make a list of filters connected to your data source by simply selecting the desired field. In Excel, slicers are tied with pivot tables and charts to create powerful and interactive reports. Slicers can also connect with other slicers and give visual feedback on which items do not have data for a given selection (see image here showing various slicers around a chart - the greyed buttons do not have any data - this is known as cross-filtering).
Found so far... The closest thing I have found is CrossFilter.js and DC.js which work with the D3 charting library. However, development on Crossfilter and DC seemed to have stopped. I'm new to web development, so if there is a simple solution to this and I'm digging to deep - let me know!
Thank you for any help!!

jquery geolocation and map highlight

We are trying to add some visual statistics related to the visitors of our website.
We are now focusing on the visitors' locations.
We want to create a map (through a jquery plugin) that would:
a)Show the location of an entered IP on the map OR if the first option is not available, we could use geoIP to get the country/city of the visitor and the jquery plugin should just place a pin on the city given. It would be good if the plugin could allow us to place more pins.
b)Based on a list of IP's, sort them and group them by country and then highlight the countries with most visitors and color them based on the number of visitors, like Google Analytics. Alternatively, this can be done on server side through geoIP and the server could just output country-code:number-of-visitors and then the jquery plugin should just make the highlights.
What do I need to look for and do you know any jquery plugins that have such functionality?
Regards
I would advice you to use the google GEOCHART, it's free, easy to integrate and fairly easy to manipulate, so you can create your own maps. You can add colors, tags and many more.. .
I hope this is some of assistence to you.. .
There are a number of mapping options available, the key is translating your geolocation (lat and long) into pixels... presumably this would need to be done in real time, and updated on the fly as the visitor infomation changes. If you could link your Google Analytics to a .csv file, ten using a library such as D3.js would allow you flexibility to show anything you'd like. The toughest bit is to get the projection right. The seminal page everyone will refer you to is this:
http://bost.ocks.org/mike/map/
It explains how you would take a shape file, turn it into a json file, which essentially plots out the global or regional map for you.

Google Analytics style number incrementing

I'm making an add-on for a fundraising site where it automatically updates the amount raised without having to refresh. I'm able to get the new amount without a problem, but instead of fading in/out when updated, I wanted to make it count up to the new number like Google Analytics does on the real time stats page.
I've tried using a for loop to increment up but I think the problem is adding a delay. any ideas?
There are two things you need: live data, and a way to show it.
For the data, you can either poll your server on a regular basis, or use something such as websockets (or one of the many ways of emulating that behavior). What you choose depends on your needs, and what is available server-side. I personally would use Node.JS with Socket.IO. It's very compatible, and can provide you with near-real-time updates.
Now for displaying it, you can do something simple such as "animating" a number in a DIV. There are also handy gauges and what not in the Google Visualization API.

Categories

Resources