Answer the question
In order to leave comments, you need to log in
How to organize the collection of price changes in a Google spreadsheet?
I take data (prices) from the site into Google spreadsheets through the importxml formula.
Prices change periodically.
How to organize the collection of price changes on the machine, and so that the old prices remain?
Answer the question
In order to leave comments, you need to log in
You can use Google Apps Script
Easiest way
Run a time based trigger on a functionmyF
function myF(){
var data = get_();
Logger.log(data);
append_(data);
}
function get_(){
var sheet = SpreadsheetApp.openById("986327f36403948feb4a")
.getSheetByName("Sheet1");
return sheet.getDataRange().getValues().slice(sheet.getFrozenRows());
}
function append_(data){
var d = new Date();
var values = data.map(function(row){
row.unshift(this.d);
return row;
}, {d:d});
var sheet = SpreadsheetApp.openById("579e832d1ced2a2cc76c")
.getSheetByName("Sheet2");
sheet.getRange(sheet.getLastRow() + 1, 1, values.length, values[0].length).setValues(values);
}
data
and add it to the Table append_(data)
. Add this function to the time based trigger.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question