Skip to content
Advertisement

how to get value from array to display as text in input field

I am using google sheet as may data and AppScript as my back end, I try my solution but unfortunately none of them work what I’m trying to do is fetch the data from Google Sheets and then display it in input fields

This is the source code for getting data from Google Sheets

JavaScript

This is the source code for getting data from getData function After fetching the data, it will look like this

JavaScript

What I’m trying to do is fetch the data where it is and display it in the input fields The application that I am working on obtains the order number from the link of the script and then passes it in the function, which in turn will fetch the data and then display and display each information in an input field The user will enter a link that looks like this:

https://script.google.com/a/herfy.com/macros/s/AKfycbwBrVDszfnKpewofnpweonfpwoenfwpeofnwpefn/dev“`?page=report&request=100“`

request=100 will get row number 100 and will pass it to getData then the data will be display in an input field or Or in my case more than one input field

I use google.script.url.getLocation to get data from the link

JavaScript

Picture for more details

I use the corporate version and I do not use the built-in app script.

Advertisement

Answer

After many attempts, I managed to find the solution to the problem and decided to answer it to help others

Google App Script Code

JavaScript

This is the source code for getting data from getData function After fetching the data, it will look like this and I am using console.log(finalData); as you can see if data is null It will have a place but will not be written null

JavaScript

Now if use the same link concept https://script.google.com/a/herfy.com/macros/s/AKfycbwBrVDszfnKpewofnpweonfpwoenfwpeofnwpefn/dev ?page=report&request=100

with this code if the page is Loaded it will get request=100

JavaScript

showReport function

JavaScript

showError function

JavaScript

I use the corporate version and I do not use the built-in app script.

Live Demo

Reference

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