0

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();
};

Alert

  • What does the dialog that they are getting say exactly? The chances are that it's the script that everyone gets when they are running a new script for the first time.. You have to authorize it. There's nothing that you can do to avoid that – Cooper Jan 05 '22 at 22:15
  • Hi Cooper, I don't have the dialog in English but I send a simple translation: Google did not verify this app the app is requesting access to sensitive information in your google account. It is not recommended to use it until the developer has verified it with Google – Gustavo Rodrigues Jan 06 '22 at 23:12
  • Okay that's what I thought it was and they just need to authorize the script. If they don't trust you and they don't wish to authorize it then they cannot use it. No way around it. But even if you get verified they will still have to authorize it but they will have the extra approval of Google to provide trust. – Cooper Jan 06 '22 at 23:50
  • And what is the procedure for google to verify my script? It has no data copy and nothing relevant. I'm not an expert, I just did it to be practical. – Gustavo Rodrigues Jan 08 '22 at 00:17
  • https://stackoverflow.com/questions/47806417/google-app-script-verify – Cooper Jan 08 '22 at 00:24

0 Answers0