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 is this type of notehead called?

What linear sensor for a keyboard?

Greco-Roman egalitarianism

Did US corporations pay demonstrators in the German demonstrations against article 13?

Drawing ramified coverings with tikz

Can I use my Chinese passport to enter China after I acquired another citizenship?

When quoting, must I also copy hyphens used to divide words that continue on the next line?

Why in book's example is used 言葉(ことば) instead of 言語(げんご)?

If a character with the Alert feat rolls a crit fail on their Perception check, are they surprised?

Did arcade monitors have same pixel aspect ratio as TV sets?

Is possible to search in vim history?

What (else) happened July 1st 1858 in London?

Is it possible to have a strip of cold climate in the middle of a planet?

Has Darkwing Duck ever met Scrooge McDuck?

Confusion on Parallelogram

What is the gram­mat­i­cal term for “‑ed” words like these?

List of people who lose a child in תנ"ך

How do I repair my stair bannister?

Can I sign legal documents with a smiley face?

How do I extrude a face to a single vertex

A social experiment. What is the worst that can happen?

How can Trident be so inexpensive? Will it orbit Triton or just do a (slow) flyby?

Could the E-bike drivetrain wear down till needing replacement after 400 km?

My friend sent me a screenshot of a transaction hash, but when I search for it I find divergent data. What happened?



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













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

Thal And Out Agency railway station See also References External links Navigation menuOfficial Web Site of Pakistan RailwaysArchivedOfficial Web Site of Pakistan Railwayseeexpanding ite

Posting a File and Associated Data to a RESTful WebService preferably as JSON2019 Community Moderator ElectionREST URI convention - Singular or plural name of resource while creating itUploading both data and files in one form using Ajax?How do I upload a file with metadata using a REST web service?REST API - file (ie images) processing - best practicesSpring: JSON data and file in the same requestREST API Put large dataPosting a file and JSON data to Spring rest serviceRESTful Web Service Upload/Download Large Data With JSONREST API Design sending JSON data and a file to the api in same requestPost JSONArray to REST servicePUT vs. POST in RESTParsing values from a JSON file?JavaScript/jQuery to download file via POST with JSON dataHow do I upload a file with metadata using a REST web service?How to POST JSON data with Curl from Terminal/Commandline to Test Spring REST?Separate REST JSON API server and client?what's the correct way to send a file from REST web service to client?How do I write JSON data to a file?What is “406-Not Acceptable Response” in HTTP?REST API - file (ie images) processing - best practices

How can I change the color of pagination dots of UIPageControl?How to change UIPageControl dotsIs there a way to change page indicator dots colorCustomize dot with image of UIPageControl at index 0 of UIPageControlNo visible @interface for 'NSObject<PageControlDelegate>' declares the selector 'pageControlPageDidChange:'How to change the color of pagination dots in UIPageControl with a different color per pagepagecontrol indicator custom image instead of DefaultChanging the colour of UIPageControl dots in MonoTouchpagecontrol selectable page visibility color?Alternative way to load ViewControllers on a UIPageControlHow to set only layer.border-color for UIpage control dots in swiftHow can I develop for iPhone using a Windows development machine?How to change the name of an iOS app?UITableView - change section header coloruipagecontrol indicator(dot)issueCustom UIPageControl dots color not changingchange the interspace between UIPageControl dotsHow to change Status Bar text color in iOSHow can I change image tintColor in iOS and WatchKitUIPageControl dots with larger space in between each dotsHow to change the color of pagination dots in UIPageControl with a different color per page