diff --git a/README.md b/README.md index c1bbc4b..3908d15 100644 --- a/README.md +++ b/README.md @@ -2,3 +2,10 @@ Google App Script Templater to create documents and spreadsheets with simple JSON SpreadSheet Sample: https://docs.google.com/spreadsheets/d/1l7sMxfD-qh4sbeu6Ax0z6v84YdahXDTG8hlPcE_vkEo/edit?usp=sharing + +Google App Script last deployed url https://script.google.com/macros/s/AKfycbxF-s25Ceg0v1i9ZqRimDBDJi2gWMCfQSjKAc1cmlWx3_e1G7py/exec + + +TO USE WITH EXAMPLE: https://script.google.com/macros/s/AKfycbxF-s25Ceg0v1i9ZqRimDBDJi2gWMCfQSjKAc1cmlWx3_e1G7py/exec?header_title=my_cool_header_title +the url will return an ID, just use this id at +https://docs.google.com/spreadsheets/d//edit#gid=0 diff --git a/SheetsTemplater.gs b/SheetsTemplater.gs index 6e2b98e..cde5aa0 100644 --- a/SheetsTemplater.gs +++ b/SheetsTemplater.gs @@ -34,7 +34,7 @@ function mock() { }; function getTemplateIdByPaymentType (paymentType) { - return {'Cheque Pré-Datado' : '1TM7lRN_HOsfYEvGazw3cvPD7D4Xy8YQTCtDRfYH53d0'}[paymentType]; + return '1l7sMxfD-qh4sbeu6Ax0z6v84YdahXDTG8hlPcE_vkEo'; }; function getSheetNewDocument (json) { @@ -58,6 +58,7 @@ function isForEach(text) { }; function processForEach (properties) { + return; var sheet = properties.sheet; var lineToRemove = properties.i; var initialColumn = properties.j; @@ -104,7 +105,7 @@ function processForEach (properties) { }; function replaceValue(sheet, row, col, json, command) { - sheet.getRange(row, col).setValue(json[command.substring(1, command.length - 1)] || ''); + sheet.getRange(row, col).setValue(json[command.split('.')[1].substring(0, command.split('.')[1].length - 1)] || ''); }; function processCell (properties) { @@ -118,10 +119,8 @@ function processCell (properties) { }; function doGet(e) { - var json = mock(); - // if (e.parameters.checkingSystem != "COINFO_PAXPRO") - // return; - // var json = e ? e.parameters : {}; + var json = e ? e.parameters : {}; + json.agencyName = 'my sheet'; var newSpreadSheet = getSheetNewDocument(json) var sheet = newSpreadSheet.sheet;