Choose specific data of a row by its indexCopy data from one file to another for rows with a same index valueGoogle Script: InputBox with drop down list spreadsheet (Not FORM)Generate a Google Doc (and PDF) of row data when a cell in a row of a sheet is editedTrying to make a script that scans a Google Sheet and emails if values are below 60%Counting rows between two specific rowsUnstable Behavior for mailApp.sendEmailSend email when certain data is selected from drop downHow to insert data into a specific row number (or the first empty row)?Google Script gives unknown errorPushing Data to Matching Row in Index

What does 'script /dev/null' do?

Are cabin dividers used to "hide" the flex of the airplane?

Uplifted animals have parts of their "brain" in various locations of their body. Where?

Why did the Germans forbid the possession of pet pigeons in Rostov-on-Don in 1941?

Map list to bin numbers

Are white and non-white police officers equally likely to kill black suspects?

Domain expired, GoDaddy holds it and is asking more money

aging parents with no investments

How can I plot a Farey diagram?

A poker game description that does not feel gimmicky

Is there any use for defining additional entity types in a SOQL FROM clause?

Unbreakable Formation vs. Cry of the Carnarium

extract characters between two commas?

Re-submission of rejected manuscript without informing co-authors

Why is the design of haulage companies so “special”?

When blogging recipes, how can I support both readers who want the narrative/journey and ones who want the printer-friendly recipe?

Does a dangling wire really electrocute me if I'm standing in water?

Can I legally use front facing blue light in the UK?

Shall I use personal or official e-mail account when registering to external websites for work purpose?

Why is my log file so massive? 22gb. I am running log backups

Why do UK politicians seemingly ignore opinion polls on Brexit?

Is a vector space a subspace of itself?

Hosting Wordpress in a EC2 Load Balanced Instance

Can I find out the caloric content of bread by dehydrating it?



Choose specific data of a row by its index


Copy data from one file to another for rows with a same index valueGoogle Script: InputBox with drop down list spreadsheet (Not FORM)Generate a Google Doc (and PDF) of row data when a cell in a row of a sheet is editedTrying to make a script that scans a Google Sheet and emails if values are below 60%Counting rows between two specific rowsUnstable Behavior for mailApp.sendEmailSend email when certain data is selected from drop downHow to insert data into a specific row number (or the first empty row)?Google Script gives unknown errorPushing Data to Matching Row in Index






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I am creating an approval workflow for my company using gg form and gg sheet. As the picture below, whenever an approver choose approve or reject in the H column, an email will automatically generate and use data in the sheet below then send to the security guy.



The problem i am facing is that for example the approver approve the request at row 4th, I do not know how to get the data at row 4th then create an email with 4th row data. I have used getRowIndex function but somehow fail. Here is my code:



var sheet = SpreadsheetApp.openById('1NoVx8cLL_x4QAJA_hNIP3bwdpwMyiSn6WZ4iGBb53Tg');
var ss = sheet.getSheetByName('Approval');
var data = ss.getDataRange().getValues();
var lastRow = ss.getLastRow();
var Status = ss.getRange(lastRow, 8).getValue();
var Index = ss.getRange(lastRow, 8).getRowIndex();

function OnEdit(e)
var data = Onsubmitssion();
if(Status == 'Approve')
SendApprovedEmail(data);
SendEmailSecurityInform(data);

if(Status == 'Reject')
SendRejectedEmail(data);


function Onsubmitssion(data)
this.SPName = ss.getRange(Index, 3).getValue();
this.Quantity = ss.getRange(Index, 4).getValue();
this.VendorName = ss.getRange(Index, 5).getValue();
var AttachmentID = ss.getRange(Index, 6).getValue();
this.res = AttachmentID.substring(33);
var res = AttachmentID.substring(33);
var files = DriveApp.getFileById(res);
DriveApp.getFolderById("1D274UGBirLMFdyafNAAN2_463m1990z2").addFile(files);
files.addViewer('tung_hoang@colpal.com');
return this;

function SendApprovedEmail(data)
var Requestor = ss.getRange(Index, 2).getValue();
MailApp.sendEmail(
to:Requestor,
subject: "Approval for spare part lending",
htmlBody: htmlEmailApproved(data)
);


function SendRejectedEmail(data)
var Requestor = ss.getRange(Index, 2).getValue();
MailApp.sendEmail(
to:Requestor,
subject: "Spare part lending rejected",
htmlBody: htmlEmailRejected(data)
);

function SendEmailSecurityInform(data)
MailApp.sendEmail(
to:'tung_hoang@colpal.com',
subject: "Yêu cầu mang hàng ra cổng",
htmlBody: htmlEmailSecurity(data)
);



enter image description here










share|improve this question






















  • Review how triggers work. developers.google.com/apps-script/guides/triggers/…

    – tehhowch
    Mar 8 at 13:05

















0















I am creating an approval workflow for my company using gg form and gg sheet. As the picture below, whenever an approver choose approve or reject in the H column, an email will automatically generate and use data in the sheet below then send to the security guy.



The problem i am facing is that for example the approver approve the request at row 4th, I do not know how to get the data at row 4th then create an email with 4th row data. I have used getRowIndex function but somehow fail. Here is my code:



var sheet = SpreadsheetApp.openById('1NoVx8cLL_x4QAJA_hNIP3bwdpwMyiSn6WZ4iGBb53Tg');
var ss = sheet.getSheetByName('Approval');
var data = ss.getDataRange().getValues();
var lastRow = ss.getLastRow();
var Status = ss.getRange(lastRow, 8).getValue();
var Index = ss.getRange(lastRow, 8).getRowIndex();

function OnEdit(e)
var data = Onsubmitssion();
if(Status == 'Approve')
SendApprovedEmail(data);
SendEmailSecurityInform(data);

if(Status == 'Reject')
SendRejectedEmail(data);


function Onsubmitssion(data)
this.SPName = ss.getRange(Index, 3).getValue();
this.Quantity = ss.getRange(Index, 4).getValue();
this.VendorName = ss.getRange(Index, 5).getValue();
var AttachmentID = ss.getRange(Index, 6).getValue();
this.res = AttachmentID.substring(33);
var res = AttachmentID.substring(33);
var files = DriveApp.getFileById(res);
DriveApp.getFolderById("1D274UGBirLMFdyafNAAN2_463m1990z2").addFile(files);
files.addViewer('tung_hoang@colpal.com');
return this;

function SendApprovedEmail(data)
var Requestor = ss.getRange(Index, 2).getValue();
MailApp.sendEmail(
to:Requestor,
subject: "Approval for spare part lending",
htmlBody: htmlEmailApproved(data)
);


function SendRejectedEmail(data)
var Requestor = ss.getRange(Index, 2).getValue();
MailApp.sendEmail(
to:Requestor,
subject: "Spare part lending rejected",
htmlBody: htmlEmailRejected(data)
);

function SendEmailSecurityInform(data)
MailApp.sendEmail(
to:'tung_hoang@colpal.com',
subject: "Yêu cầu mang hàng ra cổng",
htmlBody: htmlEmailSecurity(data)
);



enter image description here










share|improve this question






















  • Review how triggers work. developers.google.com/apps-script/guides/triggers/…

    – tehhowch
    Mar 8 at 13:05













0












0








0








I am creating an approval workflow for my company using gg form and gg sheet. As the picture below, whenever an approver choose approve or reject in the H column, an email will automatically generate and use data in the sheet below then send to the security guy.



The problem i am facing is that for example the approver approve the request at row 4th, I do not know how to get the data at row 4th then create an email with 4th row data. I have used getRowIndex function but somehow fail. Here is my code:



var sheet = SpreadsheetApp.openById('1NoVx8cLL_x4QAJA_hNIP3bwdpwMyiSn6WZ4iGBb53Tg');
var ss = sheet.getSheetByName('Approval');
var data = ss.getDataRange().getValues();
var lastRow = ss.getLastRow();
var Status = ss.getRange(lastRow, 8).getValue();
var Index = ss.getRange(lastRow, 8).getRowIndex();

function OnEdit(e)
var data = Onsubmitssion();
if(Status == 'Approve')
SendApprovedEmail(data);
SendEmailSecurityInform(data);

if(Status == 'Reject')
SendRejectedEmail(data);


function Onsubmitssion(data)
this.SPName = ss.getRange(Index, 3).getValue();
this.Quantity = ss.getRange(Index, 4).getValue();
this.VendorName = ss.getRange(Index, 5).getValue();
var AttachmentID = ss.getRange(Index, 6).getValue();
this.res = AttachmentID.substring(33);
var res = AttachmentID.substring(33);
var files = DriveApp.getFileById(res);
DriveApp.getFolderById("1D274UGBirLMFdyafNAAN2_463m1990z2").addFile(files);
files.addViewer('tung_hoang@colpal.com');
return this;

function SendApprovedEmail(data)
var Requestor = ss.getRange(Index, 2).getValue();
MailApp.sendEmail(
to:Requestor,
subject: "Approval for spare part lending",
htmlBody: htmlEmailApproved(data)
);


function SendRejectedEmail(data)
var Requestor = ss.getRange(Index, 2).getValue();
MailApp.sendEmail(
to:Requestor,
subject: "Spare part lending rejected",
htmlBody: htmlEmailRejected(data)
);

function SendEmailSecurityInform(data)
MailApp.sendEmail(
to:'tung_hoang@colpal.com',
subject: "Yêu cầu mang hàng ra cổng",
htmlBody: htmlEmailSecurity(data)
);



enter image description here










share|improve this question














I am creating an approval workflow for my company using gg form and gg sheet. As the picture below, whenever an approver choose approve or reject in the H column, an email will automatically generate and use data in the sheet below then send to the security guy.



The problem i am facing is that for example the approver approve the request at row 4th, I do not know how to get the data at row 4th then create an email with 4th row data. I have used getRowIndex function but somehow fail. Here is my code:



var sheet = SpreadsheetApp.openById('1NoVx8cLL_x4QAJA_hNIP3bwdpwMyiSn6WZ4iGBb53Tg');
var ss = sheet.getSheetByName('Approval');
var data = ss.getDataRange().getValues();
var lastRow = ss.getLastRow();
var Status = ss.getRange(lastRow, 8).getValue();
var Index = ss.getRange(lastRow, 8).getRowIndex();

function OnEdit(e)
var data = Onsubmitssion();
if(Status == 'Approve')
SendApprovedEmail(data);
SendEmailSecurityInform(data);

if(Status == 'Reject')
SendRejectedEmail(data);


function Onsubmitssion(data)
this.SPName = ss.getRange(Index, 3).getValue();
this.Quantity = ss.getRange(Index, 4).getValue();
this.VendorName = ss.getRange(Index, 5).getValue();
var AttachmentID = ss.getRange(Index, 6).getValue();
this.res = AttachmentID.substring(33);
var res = AttachmentID.substring(33);
var files = DriveApp.getFileById(res);
DriveApp.getFolderById("1D274UGBirLMFdyafNAAN2_463m1990z2").addFile(files);
files.addViewer('tung_hoang@colpal.com');
return this;

function SendApprovedEmail(data)
var Requestor = ss.getRange(Index, 2).getValue();
MailApp.sendEmail(
to:Requestor,
subject: "Approval for spare part lending",
htmlBody: htmlEmailApproved(data)
);


function SendRejectedEmail(data)
var Requestor = ss.getRange(Index, 2).getValue();
MailApp.sendEmail(
to:Requestor,
subject: "Spare part lending rejected",
htmlBody: htmlEmailRejected(data)
);

function SendEmailSecurityInform(data)
MailApp.sendEmail(
to:'tung_hoang@colpal.com',
subject: "Yêu cầu mang hàng ra cổng",
htmlBody: htmlEmailSecurity(data)
);



enter image description here







google-apps-script google-sheets appscript






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 8 at 7:10









Huỳnh TùngHuỳnh Tùng

3217




3217












  • Review how triggers work. developers.google.com/apps-script/guides/triggers/…

    – tehhowch
    Mar 8 at 13:05

















  • Review how triggers work. developers.google.com/apps-script/guides/triggers/…

    – tehhowch
    Mar 8 at 13:05
















Review how triggers work. developers.google.com/apps-script/guides/triggers/…

– tehhowch
Mar 8 at 13:05





Review how triggers work. developers.google.com/apps-script/guides/triggers/…

– tehhowch
Mar 8 at 13:05












0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55058375%2fchoose-specific-data-of-a-row-by-its-index%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55058375%2fchoose-specific-data-of-a-row-by-its-index%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

1928 у кіно

Захаров Федір Захарович

Ель Греко