Open the Google App Script
inside your spreadsheet and paste this script:
function rssfeed() {
var ss = SpreadsheetApp.getActive();
ss.getRange('Import RSS!A1').setFormula('=IMPORTFEED("https://retail-insider.com/feed/","items Title",False,100)');
ss.getRange('Import RSS!B1:B').copyTo(ss.getRange('History RSS!A1:A'), SpreadsheetApp.CopyPasteType.PASTE_VALUES, false);
ss.getRange('Import RSS!A1').clear({contentsOnly: true, skipFilteredRows: true});
}
Don't forget to change 'YOUR RSS IMPORT FORMULA'
to your formula.
Create a spreadsheet page called History RSS
.
Create a spreadsheet page called Import RSS
and in cell B1
put this formula:
=IFERROR(QUERY(UNIQUE({'History RSS'!A1:A;'Import RSS'!A1:A}),"Where Col1<>''"))
Go back to your Google App Script
project and open the Triggers
page, on that page you click on add new Trigger
and scroll through the options until set so that Trigger
is activated every 5 minutes, 10 minutes , 30 minutes, 1 hour or whatever time you prefer.
Okay, that way every time period you've chosen, the script will be activated, put your function in cell A1
of the page Import RSS
, the formula of B1
will join the data that already exists in the Column A
of the History RSS
page and the new data from Column A
of the Import RSS
page, the script will copy everything to Column A
of the History RSS
page and finally erase the cell's import formula A1
.
That way you can merge old data with new data.
Aditional:
For multiple sites:
function rssfeed() {
var ss = SpreadsheetApp.getActive();
//SiteOne
ss.getRange('Import RSS!A1').setFormula('=IMPORTFEED("https://retail-insider.com/feed/","items Title",False,100)');
ss.getRange('Import RSS!B1:B').copyTo(ss.getRange('History RSS!A1:A'), SpreadsheetApp.CopyPasteType.PASTE_VALUES, false);
ss.getRange('Import RSS!A1').clear({contentsOnly: true, skipFilteredRows: true});
//SiteTwo
ss.getRange('Import RSS!A1').setFormula('=IMPORTFEED("https://retail-insider.com/feed/","items Title",False,100)');
ss.getRange('Import RSS!B1:B').copyTo(ss.getRange('History RSS!A1:A'), SpreadsheetApp.CopyPasteType.PASTE_VALUES, false);
ss.getRange('Import RSS!A1').clear({contentsOnly: true, skipFilteredRows: true});
//SiteThree
ss.getRange('Import RSS!A1').setFormula('=IMPORTFEED("https://retail-insider.com/feed/","items Title",False,100)');
ss.getRange('Import RSS!B1:B').copyTo(ss.getRange('History RSS!A1:A'), SpreadsheetApp.CopyPasteType.PASTE_VALUES, false);
ss.getRange('Import RSS!A1').clear({contentsOnly: true, skipFilteredRows: true});
}
In the case of multiple sites, edit the formula that will be sent to the spreadsheet (.setFormula()
) in each of the imports and change to which column the result will be sent.
And for more sites, just add the part of the code below the //Site...
indication