Advertisement
RemcoE33

enlargeImage

Aug 31st, 2021
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function enlargeImage() {
  2.   const formula = SpreadsheetApp.getActiveSpreadsheet().getActiveCell().getFormula();
  3.   const url = /IMAGE\(\"(.*?)\"/g.exec(formula)[1];
  4.   const html = `
  5.     <!DOCTYPE html>
  6.     <html>
  7.       <head>
  8.         <style>
  9.           img {
  10.               max-width: 100%;
  11.               max-height: 100%;
  12.           }
  13.         </style>
  14.         <base target="_top">
  15.       </head>
  16.       <body>
  17.         <div class=img>
  18.           <img src="${url}">
  19.         </div>
  20.       </body>
  21.     </html>
  22.   `
  23.   SpreadsheetApp.getUi().showDialog(HtmlService.createHtmlOutput(html).setHeight(500).setWidth(800));
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement