Reputation: 55
With @Tanaike suggestion, I rewrote my question to make this clearer.
I would like to process a google sheet and create a string of a certain value. For example here is a made-up data set,
There are 3 rows in the data set above, I would like to create a text string with content as described below:
Here is a google sheet link for all of the images above.
Thank you for your time!
Upvotes: 0
Views: 349
Reputation: 64100
Here I did the first three strings. You can complete the rest yourself.
function stupidStrings() {
const ss=SpreadsheetApp.getActive();
const sh=ss.getActiveSheet();
//const rg=sh.getRange("A1:T4");
const rg=sh.getRange(1,1,sh.getLastRow(),sh.getLastColumn);//perhaps this is the modification you are looking for as this will get all of the rows of data
const vA=rg.getValues();
var html="";
html+=Utilities.formatString('<br />AIR***[%s][%s][%s]*99*****\\',vA[1][0],vA[1][1],vA[1][2]);
html+=Utilities.formatString('<br />PAT*[%s]*[%s]****\\',vA[1][3],vA[1][5]);
html+=Utilities.formatString('<br />PRE*[%s][%s][%s]*[%s]**\\',vA[1][12],vA[1][13],vA[1][7],vA[1][19]);
SpreadsheetApp.getUi().showModelessDialog(HtmlService.createHtmlOutput(html), 'Stupid Strings')
}
Upvotes: 2