0

I have a html form with select tag. Can I pass values to select tag from a text file or excel sheet? On start up the file data should be passed to select tag element. Is there any way to accomplish it using HTML?

PS: I am able to hardcore the values to select tag element but not sure how to pass values from file..

Thanks in advance!

Sourabh
  • 23
  • 7
  • for anything dynamic (like in ur case) you have to use JavaScript or, if you are running SSR, render it in the server and send it to the user then. – Lith Jun 22 '21 at 12:28
  • @Lith Can you show some simple example on how to do it using javascript or SSR? I am new to both topics.. – Sourabh Jun 22 '21 at 12:43
  • 1
    SSR means server side render. basically you render a page on the server and send the result to the user. This way you get the values and put them in a page and only then send it to the user. I do not know what you are using for your server, what programming language and so on hence I can not be at help. You need to google. – Lith Jun 22 '21 at 16:38
  • 1
    Now for javascript - There are many ways to do it and many tutorials online. I found one simple tutorial with vanilla JavaScript on reading the excel and converting to JSON here https://stackoverflow.com/questions/8238407/how-to-parse-excel-xls-file-in-javascript-html5 . With that JSON you just need to then map it and render select options. There are also many tutorials for that. here is a simple one i found https://stackoverflow.com/questions/53967165/how-to-render-array-of-object-in-html-element-using-javascript-using-map-functio – Lith Jun 22 '21 at 16:39
  • @Lith Thanks for the info.. I will look into it. – Sourabh Jun 22 '21 at 17:34

0 Answers0