Quantcast
Channel: Hot Weekly Questions - Web Applications Stack Exchange
Viewing all articles
Browse latest Browse all 9628

How to create dynamic text which include values from cells for alert in Google Sheets script?

$
0
0

I wrote the script which transfer values from one sheet to another sheet.
I added message of confirmation (alert) which is showing list of values before their transfer:

var response = ui.alert('Confirm', 'Выуверенычтохотитевнестиследующуюпродукциювбазуданныхсклада?'+'\n'+op2[0]+'\n'+op2[1], ui.ButtonSet.YES_NO);

Question: How to correct write script for any dymension of values list [op2], because array op2 can has various size?
Full script you can find bellow:

function dataTransfer1() { var cs = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Детали");  var csVal = cs.getRange(2, 1, cs.getLastRow(), cs.getLastColumn());  var op = csVal.getValues();  var csVal2 = cs.getRange(2, 1, cs.getLastRow(), 2);  var op2 = csVal2.getValues(); var ui = SpreadsheetApp.getUi(); var response = ui.alert('Confirm', 'Выуверенычтохотитевнестиследующуюпродукциювбазуданныхсклада?'+'\n'+op2[0]+'\n'+op2[1], ui.ButtonSet.YES_NO);// Process the user's response.if (response == ui.Button.YES) {  var copyFile = SpreadsheetApp.openById("1dRMdqpvWU01KGgeBgDuF8FzYYr2SNsqAhPpGrWAjzx0")  .getSheetByName("Приход");  var tar = copyFile.getRange(copyFile.getLastRow()+1, 1, cs.getLastRow(), cs.getLastColumn())  .setValues(op);  ui.alert('Деталивнесенывбазуданыхсклада');   csVal.clearContent();} else {}}

Viewing all articles
Browse latest Browse all 9628

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>