Script 1:
Scraping data from a website and puts the new collected data into Column A
and Column B
.
function scraping() {
var sheet = SpreadsheetApp.getActive().getSheetByName('PageA');
var url = 'www.linktoscraping.com';
const contentText = UrlFetchApp.fetch(url).getContentText();
const $ = Cheerio.load(contentText);
$('path1')
.each((index, element) => {sheet.getRange(index + 1, 1).setValue($(element).text().trim());});
$('path2')
.each((index, element) => {sheet.getRange(index + 1, 2).setValue($(element).text().trim());});
}
Script 2:
Takes the data from Column A
and Column B
and puts it in another spreadsheet:
function register() {
var SheetA = SpreadsheetApp.openById('AAAAAAA').getSheetByName('PageA');
var data = SheetA.getRange('A1:B').getValues();
var SheetB = SpreadsheetApp.openById('BBBBBBB').getSheetByName('History');
SheetB.getRange(1,1, data.length, data[0].length).setValues(data);
}
Both scripts with a trigger activated so that they run every 1 minute.
If both scripts happen to run at the same time, can one of them cause an error in the other's running or can they work simultaneously without problems?