Comments

2 comments

  • Avatar
    Kunal Ramji

    You can do this by adding a script in your template sheet:

    function copyTextToClipboard(text) {
    var textArea = document.createElement("textarea");
    textArea.classList.add('hiddenTextArea');

    textArea.value = text;

    document.body.appendChild(textArea);

    textArea.select();

    try {
    var successful = document.execCommand('copy');
    var msg = successful ? 'successful' : 'unsuccessful';
    console.log('Copying text command was ' + msg);
    } catch (err) {
    console.log('Oops, unable to copy');
    }

    document.body.removeChild(textArea);
    }

     

    On the same template sheet, you can create your button:

    <center><button class="button" onclick="copyTextToClipboard('{{Header name of what you want to copy}}')">What you want it to say in your button</button></center>

    Credit goes to Edward McMillan who created this: https://sites.google.com/view/awt-ftw/ui-color-palette

    Link to his spreadsheet: https://docs.google.com/spreadsheets/d/1ThI0olJkJUNClXDG6cyu-eCkaB8sJZrhKRVUkoBhEHQ/edit#gid=2119724170

  • Avatar
    Randolph Abelardo

    Thanks for sharing @Edward's cool use case, @Kunal !

    Unfortunately, the script used doesn't support long characters and line breaks.

    @Sony, just to set your expectations correctly, please note that this topic is beyond Awesome Table's scope of support. But this is a community where everyone's encouraged to help each orher. If anyone can help Sony with his task, please do.

    - Randy

Please sign in to leave a comment.