{"id":6589,"date":"2025-08-13T03:00:45","date_gmt":"2025-08-13T03:00:45","guid":{"rendered":"https:\/\/obsidiansofteducation.com\/?page_id=6589"},"modified":"2025-08-13T04:17:03","modified_gmt":"2025-08-13T04:17:03","slug":"how-to-display-html-table-in-mit-app-inventor","status":"publish","type":"page","link":"https:\/\/obsidiansofteducation.com\/index.php\/how-to-display-html-table-in-mit-app-inventor\/","title":{"rendered":"How to Display HTML Table in MIT App Inventor"},"content":{"rendered":"\n<p class=\"has-medium-font-size\">Hello friends,<\/p>\n\n\n\n<p class=\"has-medium-font-size\">Today, I will show you how to make an HTML table in MIT App Inventor. We normally use the built-in list view, and I have done extensive tutorials on it, including the diary app a few weeks ago, which taught how you can display images in a listview. However, if your data has multiple columns, such as data coming from a Google sheet, the data display isn\u2019t that professional and clean. So, instead of a listview, we can display the data in an HTML table using a webviewer. This will work for both iOS and Android. We can also make the HTML table clickable, i.e., enable row selection, but I will teach that in a future advanced tutorial, as there is JavaScript involved. And that version will not work on iOS. I thought that I should start with an iOS-friendly approach first.&nbsp;<\/p>\n\n\n\n<p class=\"has-medium-font-size\">Our html table will look something like this:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"472\" height=\"1024\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/08\/WhatsApp-Image-2025-08-12-at-10.15.27_3e28f0d9-472x1024.jpg\" alt=\"\" class=\"wp-image-6590\" style=\"width:306px;height:auto\" srcset=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/08\/WhatsApp-Image-2025-08-12-at-10.15.27_3e28f0d9-472x1024.jpg 472w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/08\/WhatsApp-Image-2025-08-12-at-10.15.27_3e28f0d9-138x300.jpg 138w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/08\/WhatsApp-Image-2025-08-12-at-10.15.27_3e28f0d9-708x1536.jpg 708w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/08\/WhatsApp-Image-2025-08-12-at-10.15.27_3e28f0d9.jpg 738w\" sizes=\"auto, (max-width: 472px) 100vw, 472px\" \/><\/figure>\n<\/div>\n\n\n<p class=\"has-medium-font-size\">As you can see, we have a very professional-looking table with a blue header.<\/p>\n\n\n\n<p class=\"has-medium-font-size\">So, let\u2019s begin. Open up MIT App Inventor. Go to projects. Start a new project. Let\u2019s call it HtmlTable.<\/p>\n\n\n\n<p class=\"has-medium-font-size\">From the <strong>User Interface<\/strong> palette, drag and drop a<strong> WebViewer<\/strong> component.<\/p>\n\n\n\n<p class=\"has-medium-font-size\">Our UX design is done, so let\u2019s go to the blocks section.<\/p>\n\n\n\n<p class=\"has-medium-font-size\">Make a global variable htmlContent and set it to a text block with the following code:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/08\/AD_4nXe5UKq_ibwIOEnaGfVZ6h9gNP0YL4RtQoQEt6s5oQqfg9Y3jcC_OvDT5KAV2a7mBcExKUSkRUOgouu_RszIr9BlDBRaR3We7ytENgY7vujK6lywlxc3Dn15lTc4LJW_MsYRZT69PQkey5u3Dx6cyCcmxyqJSfclUOQ.png\" alt=\"\"\/><\/figure>\n\n\n\n<p class=\"has-medium-font-size\">This is super important that you paste it the same way. You can get this code from the written tutorial link in the video description.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><em>&lt;html&gt;&lt;head&gt;&lt;meta charset=\"utf-8\"&gt;&lt;meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"&gt;&lt;title&gt;Table&lt;\/title&gt;&lt;\/head&gt;&lt;body&gt;&lt;table border=\"1\" width=\"100%\"&gt;<\/em><\/code><\/pre>\n\n\n\n<p class=\"has-medium-font-size\">Next, for the purpose of this tutorial, I am going to make a 2D data list that will contain our table data. A 2D list in programming languages means a list where each item in the list is also a list.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/08\/AD_4nXcCl_I1f0NFJCL-leigNYDra3FRPiF5Plp9gHD_XavMLGjrngEGlFzocgPh0mewcqri1paBbl3kH9-hhFbU0xJPp5h79bhF6mUCoM32eXgdXosIP4UlABz1PKmp3DvHgXVqIJXIuQkey5u3Dx6cyCcmxyqJSfclUOQ.png\" alt=\"\"\/><\/figure>\n\n\n\n<p class=\"has-medium-font-size\">Your list might be coming from CloudDB or Google Sheet, and I have already done tutorials on loading data from a Google Sheet and CloudDB.<\/p>\n\n\n\n<p class=\"has-medium-font-size\">Next, make a procedure and name it makeTable.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/08\/AD_4nXeEe49KVIqXWlbvuRuLkfxqomOOCo9FWMGMZqnHBv7jn7ochesbILp4nR2TojSGWYyPlFVv_MBaL6N0HFUu1UvJG2iPMafj3lHk2qBUKBBv8pm0B9IQ9EqxmAq-Yx0ck8ToEVN8wAkey5u3Dx6cyCcmxyqJSfclUOQ.png\" alt=\"\"\/><\/figure>\n\n\n\n<p class=\"has-medium-font-size\">Call this procedure from the initialize event of Screen1.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/08\/AD_4nXcWlMW8x0Z1pUFCovdntEeQVXfyYJE9tXnabyiRI-oDYyJKtM3ld_jfw9JQKSNoMMHnaUuXHE-6fGic8n4_gNBJUlxLTy_DdSgkLirqNCWBIP1ps-4dveABQ6iWhk7pRq-LtY8dRgkey5u3Dx6cyCcmxyqJSfclUOQ.png\" alt=\"\"\/><\/figure>\n\n\n\n<p class=\"has-medium-font-size\">Now, let\u2019s work on the procedure\u2019s code:<\/p>\n\n\n\n<p class=\"has-medium-font-size\">Our htmlText variable ended with the &lt;table&gt; being opened. Now, we will construct the table headers and table rows using our global list called data that we have already initialize with some patient data.<\/p>\n\n\n\n<p class=\"has-medium-font-size\">We make a local variable for our headerHTML and give it the starting row tag with a background color of blue. You can use some other color too.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/08\/AD_4nXf7kV05AiMWdAReO79P4ihB6IVubmESvaTPNIOpFUgXlaNwnDCfj4pBAcSztflh9isyZLGdX5ANyZXjPdZQfIKKvVGYnYfAWT8nRzGZCy12t0vLa-05-THz6nJlbguwjoJM0aFBSgkey5u3Dx6cyCcmxyqJSfclUOQ.png\" alt=\"\"\/><\/figure>\n\n\n\n<p class=\"has-medium-font-size\">And then, using a for loop, we go through the first row of our patientsdatalist (or any other 2D list such as data coming from a Google Sheet), and we start adding &lt;th&gt; tags for table headers i.e., names of the columns. I will make them bold with font color white. The spellings and the order are very important while building this dynamic HTML string.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/08\/AD_4nXfAXUpNAQfX7INcAPw4wIaiNL0K1lfoaxXIFOQM9ckhplj8NdLasJJFlRCrvqatD0wws4P1ecXNvDcc2P6tPsc4HPYmnDnhEeXQivc6sebPdoBo2dAKC6QXa3cFMTNe0qJCZHmh5gkey5u3Dx6cyCcmxyqJSfclUOQ.png\" alt=\"\"\/><\/figure>\n\n\n\n<p class=\"has-medium-font-size\">At the end, we join the &lt;\/tr&gt; i.e. the closing table row tag, to the header HTML. And we join this constructed headerhtml to our htmlText variable that had the table head and style HTML set in it. Make sure you do this within the local variable block.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/08\/AD_4nXfd9W1gbp44vH8bChT1yY9FULqNKFAMEo-dXgsTStwZtV4VaR80QirkdQzDLDVIVP3x9Gsw9J__oHMqwEBWCAA6NN2rDnqY3PYw7SoacDEuO96-vriGZCLpA5w4KmDGNEM5X6TD8wkey5u3Dx6cyCcmxyqJSfclUOQ.png\" alt=\"\"\/><\/figure>\n\n\n\n<p class=\"has-medium-font-size\">Next, we construct the data rows. Again, make a local variable and put this outside the first local variable block.<\/p>\n\n\n\n<p class=\"has-medium-font-size\"> <img loading=\"lazy\" decoding=\"async\" width=\"372\" height=\"84\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/08\/AD_4nXfIfyMp5vswx6ntZLwh3R89S2jZHpGOA4RkJC2x6FOlg3VrX_FS8rZfgmpJUtfQYSyVoIvzpigdCb0o1ms0Cf-HtQxocO9fi67iBHeGQpIzONYDYv-cBV6ulnYNo-fY5TC0Cqg3vAkey5u3Dx6cyCcmxyqJSfclUOQ.png\"><\/p>\n\n\n\n<p class=\"has-medium-font-size\">Now, we will use a for each index block from Control as we need to start from index 2 of our patientsDataList since index 1 contained the column names or table headers. <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/08\/AD_4nXcbigNcCvMxa1y87h-icSRFAhKwJy02DdyOhT7AzvfFpjOomDK7z8iiGwDhmfNELfeXnUA5Bfdq8h4bt-d73Zfweyn4frDrZ08f7IJ_12SYqb83Mab7t26byPABNcMn67WvJWD8key5u3Dx6cyCcmxyqJSfclUOQ.png\" width=\"631\" height=\"412\"><\/p>\n\n\n\n<p class=\"has-medium-font-size\">After the for loop, we will join the dynamically constructed dataHtml to our htmtContent string. Again, this has to be within the local dataHtml variable block.&nbsp;&nbsp;&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/08\/AD_4nXeVDZ8baf96HwiqwWUXXqzkfiWRuKlVw8hw7_IXI3isvsY2qjGKVgEOzzkZ158ybRPb5L2-YPIWpsyII9O8MqTJsIfhFxouDvNCFsx-ZfEUAxTb8rgeDPmdeViltIFVr7csanoXgwkey5u3Dx6cyCcmxyqJSfclUOQ.png\" alt=\"\"\/><\/figure>\n\n\n\n<p class=\"has-medium-font-size\">Next, outside the local variable block, we will join the closing table, body and html tags to our htmlContent string and we will use the Webviewer goToUrl block with this final htmlContent string but we will also put this before it: <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><em>data:text\/html;charset=utf-8,<\/em><\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/08\/AD_4nXfRRniyjBSgV0xPeA8WeS-MmjWBaIvu7diaUQRRveqwr65PGKHKlXevmMH6HB5fzZZDIXUXQYQZqQS3QWaq2m7PuNCq3EPPUW8LrMNjcIzzWfnG4p3Buw6zo9PRbRxC3SiWJgimkAkey5u3Dx6cyCcmxyqJSfclUOQ.png\" alt=\"\"\/><\/figure>\n\n\n\n<p class=\"has-medium-font-size\">So the final makeTable looks like this:<\/p>\n\n\n\n<p> <img loading=\"lazy\" decoding=\"async\" width=\"552\" height=\"834\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/08\/AD_4nXebcPVHzBgAu1T0qciNyd0EgYxwu61MOnLHSskGLjDnnlmhTh8d3dgLWa5wTT3ywT4WT6jvjvJrVHDjxYkf_pWk4iuDqASIVXEKSFmY8hSv_H33ZWxZ7o-AUXVK4Kj2mt4lo11l5Qkey5u3Dx6cyCcmxyqJSfclUOQ.png\"><\/p>\n\n\n\n<p class=\"has-medium-font-size\">and if you try your app, your table should be displaying.<\/p>\n\n\n\n<p class=\"has-medium-font-size\">So, this is done. I hope you liked this tutorial. You can also have a look at the video tutorial here:<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<p class=\"responsive-video-wrap clr\"><iframe loading=\"lazy\" title=\"HTML Table in MIT App Inventor (No More Messy ListView) - No Extension Needed\" width=\"1200\" height=\"675\" src=\"https:\/\/www.youtube.com\/embed\/6Sex8KBhD0s?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/p>\n<\/div><\/figure>\n\n\n\n<p class=\"has-medium-font-size\">Please like my videos and share it with your friends and family. Also, subscribe to my channel and press the bell icon so you don\u2019t miss any of the great projects I have planned for you.<\/p>\n\n\n\n<p class=\"has-medium-font-size\"><a href=\"https:\/\/www.youtube.com\/c\/obsidiansofteducation\" target=\"_blank\" rel=\"noopener\">https:\/\/www.youtube.com\/c\/obsidiansofteducation<\/a><\/p>\n\n\n\n<p class=\"has-medium-font-size\">Please like my Facebook page and Instagram page for more educational resources and tips.<\/p>\n\n\n\n<p class=\"has-medium-font-size\"><strong>Facebook:<\/strong><a href=\"https:\/\/www.blogger.com\/blog\/page\/edit\/4947000819484484884\/7140650632339107612#\" target=\"_blank\" rel=\"noopener\">&nbsp;https:\/\/www.facebook.com\/ObsidianSoft\/<\/a><\/p>\n\n\n\n<p class=\"has-medium-font-size\"><strong>Instagram:<\/strong><a href=\"https:\/\/www.blogger.com\/blog\/page\/edit\/4947000819484484884\/7140650632339107612#\" target=\"_blank\" rel=\"noopener\">&nbsp;https:\/\/www.instagram.com\/obsidiansoftapps\/<\/a><\/p>\n\n\n\n<p class=\"has-medium-font-size\"><strong>Pinterest:<\/strong>&nbsp;<a href=\"https:\/\/www.pinterest.com\/obsidiansoft\/\" target=\"_blank\" rel=\"noopener\">https:\/\/www.pinterest.com\/obsidiansoft\/<\/a><\/p>\n\n\n\n<p class=\"has-medium-font-size\">For links to free educational&nbsp;<a href=\"https:\/\/obsidiansofteducation.com\/index.php\/flappy-bird-game-mit-app-inventor\/#\">&nbsp;apps<\/a>, have a look at the&nbsp;<a href=\"https:\/\/obsidiansofteducation.com\/index.php\/mobile-apps\/\">educational apps page<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hello friends, Today, I will show you how to make an HTML table in MIT App Inventor. We normally use the built-in list view, and I have done extensive tutorials on it, including the diary app a few weeks ago, which taught how you can display images in a listview. However, if your data has [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-6589","page","type-page","status-publish","hentry","entry"],"_links":{"self":[{"href":"https:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/pages\/6589","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/comments?post=6589"}],"version-history":[{"count":2,"href":"https:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/pages\/6589\/revisions"}],"predecessor-version":[{"id":6605,"href":"https:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/pages\/6589\/revisions\/6605"}],"wp:attachment":[{"href":"https:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/media?parent=6589"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}