bradjasper / ImportJSON

Import JSON into Google Sheets, this library adds various ImportJSON functions to your spreadsheet
GNU Lesser General Public License v3.0
2.11k stars 1.06k forks source link

Permanently Import Data and Disable Reloads? #64

Open BryanHurst opened 6 years ago

BryanHurst commented 6 years ago

The API that we are querying allows us a limited number of requests per day, and the ImportJSON script is firing every time somebody loads the sheet.

Is there a way to get it to permanently insert data into a range of cells and not fire off again unless specifically prompted?

tordans commented 6 years ago

@BryanHurst The easy way out is to have a public sheet that everyone loads daily. And a Source-Data-Sheet just for your. In the Source-Data you put the import formular. Then you copy the content and paste it as text to the public sheet. This way your public sheet has "frozen" content.

BryanHurst commented 6 years ago

@tordans Thanks for the idea, that definitely will work for now.

It would be great if a more integrated switch of sorts could be implemented in the future.

ghost commented 6 years ago

You could always have two sheets: one for the live data, and one with data copied as text only when you press a button / run a script. The following can allow you to do that:

function lockData() {

var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet(); var lockedData = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('lockedData Sheet');

lockedData.getRange('A1:BA100').copyTo(lockedData.getRange('A1:BA100'),{contentsOnly: true}) }