Comments (8)
Thanks but none of the above solutions are generic enough to be used as a standard addition to the script itself...
I'm looking more in terms of a onLoad()
function that will auto update ANY cell that references the function(s) used from this script...
Eg. without user modification and tailoring for use by ANY spreadsheet that uses this script...
from importjson.
@TriMoon @gsivaprabu I've written an article about how to refresh automatically a spreadsheet with ImportJSON.
@bradjasper It requires some manual steps within the sheet itself to do the setup, but I think the process can be officially documented in this repository, if you wish to do so.
Basically, it relies on a special sheet (in my example, but could be a special cell as well) to be auto updated using App Scripts and does a force refresh of all the ImportJSON referencing it.
It can be used both to refresh the sheet upon "open" event, and at a predefined interval.
from importjson.
code 👍
function importJSONupdate() {
var queryString = Math.random();
var cellFunction1 = '=IMPORTJSON(“' + SpreadsheetApp.getActiveSheet().getRange('A50').getValue() + '?' + queryString + '”,”'+ SpreadsheetApp.getActiveSheet().getRange('B50').getValue() + '”,”noInherit,noTruncate”)';
SpreadsheetApp.getActiveSheet().getRange('A1').setValue(cellFunction1);
from importjson.
For example to refresh one or more cells each minute I'm using this trick step by step :
-
Add a function in your script like :
function UpdateData() { SpreadsheetApp.getActiveSheet().getRange('H22').setValue(importJson(ImportJSON(“http://date.jsontest.com", “/date”, “noInherit, noTruncate”); }
-
Go to Edit and apply a trigger 'time interval' on UpdateData( see https://developers.google.com/apps-script/guides/triggers/installable#managing_triggers_manually). Also you can set a trigger on document's opening or other event.
I hope it will help you. ;)
from importjson.
I am also facing same issue, When i am able to modify the cell that time only i can able to get the data. My data provider given every 1 min dynamic data . How can i handle any solutions or workarround
My Opensource lib:-
My API Provider:-
Screenshot:-
Any one have idea means please suggest
regards,
@gsivaprabu
from importjson.
Thanks but none of the above solutions are generic enough to be used as a standard addition to the script itself...
I'm looking more in terms of a
onLoad()
function that will auto update ANY cell that references the function(s) used from this script...
Eg. without user modification and tailoring for use by ANY spreadsheet that uses this script...
Hi @TriMoon you got any solutions ?
from importjson.
code
function importJSONupdate() {
var queryString = Math.random();var cellFunction1 = '=IMPORTJSON(“' + SpreadsheetApp.getActiveSheet().getRange('A50').getValue() + '?' + queryString + '”,”'+ SpreadsheetApp.getActiveSheet().getRange('B50').getValue() + '”,”noInherit,noTruncate”)';
SpreadsheetApp.getActiveSheet().getRange('A1').setValue(cellFunction1);
I have this call how can i pass?
Every 1 minute need to update
=ImportJSON("https://www.nseindia.com/live_market/dynaContent/live_watch/stock_watch/foSecStockWatch.json")
from importjson.
I tried something hacky but ran into permission issues:
function importJSONAutoRefresh(url, query, parseOptions, cellSource) {
var random = Math.random();
url += '&random=' + random;
console.log(SpreadsheetApp.getActiveSheet().getRange(cellSource).getValue())
var refreshedImportJSON = 'importJSONWithRefresh("' + url + '", "' + query + '", "' + parseOptions + '", "' + cellSource + '")';
console.log(refreshedImportJSON);
SpreadsheetApp.getActiveSheet().getRange(cellSource).setValue(refreshedImportJSON);
}
I added this function but I get You do not have permission to call setValue
(see https://stackoverflow.com/a/15936281/2391795) and I wonder how other people could make something like that work, I'm trying to update the cell that contains the call to the function.
from importjson.
Related Issues (20)
- How to trigger ImportJSON with a script HOT 1
- ImportJSON & TriggerAutoRefresh Errors
- Function does not compile; Exception: Attribute provided with no value: url HOT 2
- Import JSON stops working! HOT 10
- ImportJSON "Loading..." Issue HOT 9
- Need help in changing item in an array
- How to use "allHeaders" option but only return row 1 (ie 2nd row) HOT 1
- How to add timer? HOT 2
- How to add Api Key header HOT 1
- Extract information from NSE website to Google sheet/ Excel spreadsheet
- Syntax for ImportJSONViaPost
- Read list of URLs from cell range HOT 1
- ERROR Attribute provided with no value: url
- How can I get this value? HOT 1
- Any way to import multiple URLs
- returned code 404 (line 220)
- Only outputting object Object Array
- Flatten JSON not create new rows
- Error message after initial loading...
- #ERROR! SyntaxError: Unexpected end of JSON input (Line 221)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from importjson.