I'm making a script to extract the closing stock prices from the IBOV to share with some colleagues. But when they run the script an alert message appears saying it is not trustworthy until the developer checks the script with google.
I'm just using data from the spreadsheet itself, with information from GOOGLEFINANCE.
How can I check the script and the alert no longer appears?
Here's the script: (Some words are in Portuguese because I'm Brazilian)
function Classificar() {
var planilha = SpreadsheetApp.getActive();
var guia = planilha.getSheetByName("Fechamento");
guia.getRange('D2').activate();
var criteria = SpreadsheetApp.newFilterCriteria()
.whenCellNotEmpty()
.build();
guia.getActiveRange().getFilter().setColumnFilterCriteria(4, criteria);
guia.getRange("B2:D").activate();
guia.getActiveRange().getFilter().sort(4, false);
guia.getRange("B3:D3").activate();
guia.getRange("F4").activate();
guia.getRange("B3:D7").copyTo(guia.getActiveRange(), SpreadsheetApp.CopyPasteType.PASTE_NORMAL, false);
guia.getRange("B2:D").activate();
guia.getActiveRange().getFilter().sort(4, true);
guia.getRange("B3:D3").activate();
guia.getRange('F12').activate();
guia.getRange('B3:D7').copyTo(guia.getActiveRange(), SpreadsheetApp.CopyPasteType.PASTE_NORMAL, false);
guia.getRange('D2').activate();
var criteria = SpreadsheetApp.newFilterCriteria()
.build();
guia.getActiveRange().getFilter().setColumnFilterCriteria(4, criteria);
FormatarCor();
};
function LimpaFechamento() {
var spreadsheet = SpreadsheetApp.getActive();
spreadsheet.getRange('F4:H8').activate();
spreadsheet.getActiveRangeList().clear({contentsOnly: true, skipFilteredRows: true});
spreadsheet.getRange('F12:H16').activate();
spreadsheet.getActiveRangeList().clear({contentsOnly: true, skipFilteredRows: true});
};
function FormatarCor() {
var spreadsheet = SpreadsheetApp.getActive();
spreadsheet.getRangeList(['H4:H8', 'H12:H16']).activate();
var conditionalFormatRules = spreadsheet.getActiveSheet().getConditionalFormatRules();
conditionalFormatRules.push(SpreadsheetApp.newConditionalFormatRule()
.setRanges([spreadsheet.getRange('H4:H8'), spreadsheet.getRange('H12:H16')])
.whenCellNotEmpty()
.setBackground('#B7E1CD')
.build());
spreadsheet.getActiveSheet().setConditionalFormatRules(conditionalFormatRules);
conditionalFormatRules = spreadsheet.getActiveSheet().getConditionalFormatRules();
conditionalFormatRules.splice(conditionalFormatRules.length - 1, 1, SpreadsheetApp.newConditionalFormatRule()
.setRanges([spreadsheet.getRange('H4:H8'), spreadsheet.getRange('H12:H16')])
.whenNumberLessThan(0)
.setBackground('#B7E1CD')
.build());
spreadsheet.getActiveSheet().setConditionalFormatRules(conditionalFormatRules);
conditionalFormatRules = spreadsheet.getActiveSheet().getConditionalFormatRules();
conditionalFormatRules.splice(conditionalFormatRules.length - 1, 1, SpreadsheetApp.newConditionalFormatRule()
.setRanges([spreadsheet.getRange('H4:H8'), spreadsheet.getRange('H12:H16')])
.whenNumberLessThan(0)
.setBackground('#F4C7C3')
.build());
spreadsheet.getActiveSheet().setConditionalFormatRules(conditionalFormatRules);
conditionalFormatRules = spreadsheet.getActiveSheet().getConditionalFormatRules();
conditionalFormatRules.push(SpreadsheetApp.newConditionalFormatRule()
.setRanges([spreadsheet.getRange('H4:H8'), spreadsheet.getRange('H12:H16')])
.whenCellNotEmpty()
.setBackground('#B7E1CD')
.build());
spreadsheet.getActiveSheet().setConditionalFormatRules(conditionalFormatRules);
conditionalFormatRules = spreadsheet.getActiveSheet().getConditionalFormatRules();
conditionalFormatRules.splice(conditionalFormatRules.length - 1, 1, SpreadsheetApp.newConditionalFormatRule()
.setRanges([spreadsheet.getRange('H4:H8'), spreadsheet.getRange('H12:H16')])
.whenNumberGreaterThan(0)
.setBackground('#B7E1CD')
.build());
spreadsheet.getActiveSheet().setConditionalFormatRules(conditionalFormatRules);
spreadsheet.getRange('J2').activate();
};