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

Run Google Sheet Script from 3rd row [closed]

$
0
0

I have just started working with the google sheet scripts. I'm creating a PDF(converting Google Doc to PDF) that is taking data from Google Form inputs. I have written this attached script but my data is starting from the 3rd row in the Google sheet. What changes do I need to do in the attached code?

function myFunction() {}function createPDF(){ const info = {'Timestamp': ['3/24/2021 18:11:33'],'Facility Name': ['Ashoka'],'Location Code': ['2086'],'Facility Name': ['Ashoka'],'Overall Score': ['100%'],'Sort': ['100%'],'Set in Order': ['100%'],'Shine': ['100%'],'Standardize': ['100%'],'Sustain': ['100%'],'PI1': ['https://drive.google.com/open?id=1u65TEtEqlSxxM6IM6wbnZs4RREQ9RuTf'],'PI2': ['https://drive.google.com/open?id=1LrhZ2KbGy19p0Fbb2Ob1UbZwrhzfEcax'],'PI3': ['https://drive.google.com/open?id=1phsTWP6PrQf2O_LH6A0RDVo-2uPhufeH'],'PI4': ['https://drive.google.com/open?id=1gIKyHqIC_eB5ygaONXZU6Ek4wQezSmDM'],'PI5': ['https://drive.google.com/open?id=1QyFEfJ5BoB0QPJuI_vn9cW9K3ywk_zYb'],'PI6': ['https://drive.google.com/open?id=1vNPchmaDSTk3AnPlmRKDXacg2TjAMA1_'],'PI7': [''],'PI8': [''],'PI9': [''],'PI10': [''],'BI1': [''],'BI2': [''],'BI3': [''],'BI4': [''],'BI5': [''],'BI6': [''],'BI7': [''],'BI8': [''],'BI9': [''],'BI10': [''],'COMMENT SEQUENCE': ['kdjf'],'C1': ['fdij'],'C2': ['klsjdf'],'C3': ['kdjf'],'C4': [''],'C5': [''],'C6': [''],'C7': [''],'C8': [''],'C9': [''],'C10': [''],'C11': [''],'C12': [''],'C13': [''],'C14': [''],'C15': [''],'C16': [''],'C17': [''],'C18': [''],'C19': [''],'C20': [''],'C21': [''],'C22': [''],'C23': [''],'C24': [''],'C25': [''],'C26': [''],'C27': [''],'C28': [''],'C29': [''],'C30': [''],'C31': [''],'C32': [''],'C33': [''],'C34': [''],'C35': [''],'C36': [''],'C37': [''],'C38': [''],'C39': [''],'C40': [''],'C41': [''],'C42': [''],'C43': [''],'C44': [''],'C45': [''],'C46': [''],'C47': [''],'C48': [''],'C49': [''],'C50': ['']};  const pdfFolder = DriveApp.getFolderById("1I7ChP1xRbl7GwnvAcXV_9JIHegvsU2PO");  const tempFolder = DriveApp.getFolderById("1srcXlFgmh01e4Psw_dxM4bNgarY6tfli");  const templateDoc = DriveApp.getFileById("1xype5jUa6H8VJ4JSaV-KfccSjK5w6e-hmoI1k6MXSOc");  const newTempFile = templateDoc.makeCopy(tempFolder);  const openDoc =  DocumentApp.openById(newTempFile.getId());  const body = openDoc.getBody();  body.replaceText(" {Location Code}",info['Location Code'][0]);  body.replaceText(" {Facility Name}",info['Facility Name'][0]);  body.replaceText(" {Timestamp}",info['Timestamp'][0]);  body.replaceText(" {Overall Score}",info['Overall Score'][0]);  body.replaceText(" {Sort}",info['Sort'][0]);  body.replaceText(" {Set in Order}",info['{Set in Order'][0]);  body.replaceText(" {Shine}",info['Shine'][0]);  body.replaceText(" {Standardize}",info['Standardize'][0]);  body.replaceText(" {Sustain}",info['Sustain'][1]);  body.replaceText(" {C1}",info['C1'][1]);  body.replaceText(" {C2}",info['C2'][1]);  body.replaceText(" {C3}",info['C3'][1]);  body.replaceText(" {C4}",info['C4'][1]);  body.replaceText(" {C5}",info['C5'][1]);  body.replaceText(" {C6}",info['C6'][1]);  body.replaceText(" {C7}",info['C7'][1]);  body.replaceText(" {C8}",info['C8'][1]);  body.replaceText(" {C9}",info['C9'][1]);  body.replaceText(" {C10}",info['C10'][1]);  body.replaceText(" {C11}",info['C11'][1]);  body.replaceText(" {C12}",info['C12'][1]);  body.replaceText(" {C13}",info['C13'][1]);  body.replaceText(" {C14}",info['C14'][1]);  body.replaceText(" {C15}",info['C15'][1]);  body.replaceText(" {C16}",info['C16'][1]);  body.replaceText(" {C17}",info['C17'][1]);  body.replaceText(" {C18}",info['C18'][1]);  body.replaceText(" {C19}",info['C19'][1]);  body.replaceText(" {C20}",info['C20'][1]);  body.replaceText(" {C21}",info['C21'][1]);  body.replaceText(" {C22}",info['C22'][1]);  body.replaceText(" {C23}",info['C23'][1]);  body.replaceText(" {C24}",info['C24'][1]);  body.replaceText(" {C25}",info['C25'][1]);  body.replaceText(" {C26}",info['C26'][1]);  body.replaceText(" {C27}",info['C27'][1]);  body.replaceText(" {C28}",info['C28'][1]);  body.replaceText(" {C29}",info['C29'][1]);  body.replaceText(" {C30}",info['C30'][1]);  body.replaceText(" {C31}",info['C31'][1]);  body.replaceText(" {C32}",info['C32'][1]);  body.replaceText(" {C33}",info['C33'][1]);  body.replaceText(" {C34}",info['C34'][1]);  body.replaceText(" {C35}",info['C35'][1]);  body.replaceText(" {C36}",info['C36'][1]);  body.replaceText(" {C37}",info['C37'][1]);  body.replaceText(" {C38}",info['C38'][1]);  body.replaceText(" {C39}",info['C39'][1]);  body.replaceText(" {C40}",info['C40'][1]);  body.replaceText(" {C41}",info['C41'][1]);  body.replaceText(" {C42}",info['C42'][1]);  body.replaceText(" {C43}",info['C43'][0]);  body.replaceText(" {C44}",info['C44'][0]);  body.replaceText(" {C45}",info['C45'][0]);  body.replaceText(" {C46}",info['C46'][0]);  body.replaceText(" {C47}",info['C47'][0]);  body.replaceText(" {C48}",info['C48'][0]);  body.replaceText(" {C49}",info['C49'][0]);  body.replaceText(" {C50}",info['C50'][0]);  body.replaceText(" {C50}",info['C50'][0]);  body.replaceText(" {BI1}",info['BI1'][0]);  body.replaceText(" {BI2}",info['BI2'][0]);  body.replaceText(" {BI3}",info['BI3'][0]);  body.replaceText(" {BI4}",info['BI4'][0]);  body.replaceText(" {BI5}",info['BI5'][0]);  body.replaceText(" {BI6}",info['BI6'][0]);  body.replaceText(" {BI7}",info['BI7'][0]);  body.replaceText(" {BI8}",info['BI8'][0]);  body.replaceText(" {BI9}",info['BI9'][0]);  body.replaceText(" {BI10}",info['BI10'][0]);  body.replaceText(" {PI1}",info['PI1'][0]);  body.replaceText(" {PI2}",info['PI2'][0]);  body.replaceText(" {PI3}",info['PI3'][0]);  body.replaceText(" {PI4}",info['PI4'][0]);  body.replaceText(" {PI5}",info['PI5'][0]);  body.replaceText(" {PI6}",info['PI6'][0]);  body.replaceText(" {PI7}",info['PI7'][0]);  body.replaceText(" {PI8}",info['PI8'][0]);  body.replaceText(" {PI9}",info['PI9'][0]);  body.replaceText(" {PI10}",info['PI10'][0]);  openDoc.saveAndClose();  const blobPDF = newTempFile.getAs(MimeType.PDF);  /** @type {any} */}

Script image1

Script image2

Script image3

Also getting error while running this script.


Viewing all articles
Browse latest Browse all 9788

Latest Images

Trending Articles



Latest Images

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