Skip to content
Advertisement

GAS, Bootstrap Web form Searches and Shows Data in a table, BUT it does NOT show links or hyperlinks to click on them (from spreadsheet)

Here is the web app

https://script.google.com/macros/s/AKfycbyEHj5qtIeCZh4rR6FutBLQ3N9NihreaTv7BFj4_saOfNWJUG0Tn2OtvzQs4zASYHnNiA/exec

Any idea on how could I make it show up the links or hyperlinks some cells have?

I have made this web form mainly following a tutorial so I’m somewhat new, I try to understand most of the code but truly it’s quite hard for me so if this is something that’s too hard for a noob to handle I understand

And here is the code code.gs

JavaScript

And the 2nd file

Index HTML file

JavaScript

Sample Data sample data used here

Photoshopped output

Desired Output

Advertisement

Answer

I believe your goal as follows.

  • You want to convert the images from Sample Data to Photoshopped output in your question.
  • The column “K” has the hyperlinks and you want to set the hyperlinks to the HTML side.

Modification points:

  • When I saw your script, Sheets.Spreadsheets.Values.get is used. In this case, unfortunately, the hyperlinks cannot be directly retrieved.
  • In this case, I would like to propose the following flow.
    1. Retrieve values from the column “K” and retrieve the URLs with getRichTextValues.
    2. Create an array for returning to Javascript side.

When above points are reflected to your script, it becomes as follows.

Modified script:

Please modify the function search in Google Apps Script side as follows.

JavaScript

Note:

  • When you modified the Google Apps Script, please modify the deployment as new version. By this, the modified script is reflected to Web Apps. Please be careful this.
  • You can see the detail of this at the report of “Redeploying Web Apps without Changing URL of Web Apps for new IDE“.
  • I proposed above modified script using your sample input and output images. So, when your actual situation is different from it, the script might not be able to be used. Please be careful this.

References:

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement