No character limit input text Google app script

53 views Asked by At

I have strings I need to process that are greater than 50,000 characters.

So, I can not paste these into a cell. So, I am trying to use an inputBox to bypass this limitation.

But I get Error resuming script execution when I run testDialog.

Is there a way to get this to work?

In Code.gs

function testDialog() {

 let result = Browser.inputBox('Paste HTML below', Browser.Buttons.OK_CANCEL);
 console.log(result)
 //Output to Html
 var template = HtmlService.createTemplateFromFile('Page');

  template.temp = result;
  var htmlOutput = template.evaluate();
                  htmlOutput.setWidth(610)
                  htmlOutput.setHeight(810);
  SpreadsheetApp.getUi().showModalDialog(htmlOutput, 'Lots');
}

In copy.html

<button id="top" style="margin-bottom: 25px;">Copy</button><input style="width:25%;height:30px;" type="button" value="Close" onClick="google.script.host.close();" />
<textarea id="copy" cols="79%" rows="40.5%"><?=temp?></textarea>
<button id="bottom"style="margin-top: 25px;">Copy</button><input style="width:25%;height:30px;" type="button" value="Close" onClick="google.script.host.close();" />

<script>
    function logToConsole() {
        var userInput = document.getElementById("user-input-box").value;
        google.script.run.withSuccessHandler(closeDialog).doSomething(userInput);
    }

    function closeDialog() {
        google.script.host.close();
    }
</script>
<input type="button" value="Close" onclick="logToConsole()" />


<script type="text/javascript">
   let t = document.getElementById('copy');
   let copy = () => {
     t.select();
     document.execCommand('copy');
   };
   
  /* copy(); */
  let bt_top = document.getElementById("top");
  bt_top.addEventListener('click',copy);
  
  let bt_bottom = document.getElementById("bottom");
  bt_bottom.addEventListener('click',copy);
 </script>

<style> 
//Remove border
textarea {
  padding: 0;
  margin: 0;
  border: none;
  overflow: hidden;
}

textarea:focus {
  outline: none;
}

button {
  height: 30px;
  width:68%;
  font-weight: bold;
  background: #00ff00;
  display: inline-block;
}

button:hover {
  background: buttonface;
}

.docs-gm-dialogs .modal-dialog {
    padding: 10px;
    padding-bottom: 0;
    margin-bottom: 0;
    bottom: 0;
}
</style>

0

There are 0 answers