{"id":4295,"date":"2018-08-07T14:53:26","date_gmt":"2018-08-07T14:53:26","guid":{"rendered":"https:\/\/max-drake.cc\/?p=4295"},"modified":"2018-08-07T17:08:35","modified_gmt":"2018-08-07T17:08:35","slug":"web-data3-part-2-google-sheets-api-to-web-page-automation","status":"publish","type":"post","link":"https:\/\/max-drake.cc\/?p=4295","title":{"rendered":"Web Data 3- Part 2. Google Sheets API to Web Page automation"},"content":{"rendered":"<p>I like it when I find some useful code and it works straight away. When it doesn&#8217;t I end up spending an awful lot of time trying to figure out what is happening. turning the programmers dark magic into something comprehensible.<\/p>\n<p>Continuing on from the previous post I started to look at the output and code a bit more closely. I think this process is quite useful, so I decided to write about the coding process so that if I revisit this later I wont spend so much time trying to re-figure it out. The main area of focus is on Anthony Brunson\u2019s tutorial number 2 of adding the extra coding to display results to a web page. The google API will just stay as Dark Magic!<\/p>\n<p>Here is <strong><a href=\"https:\/\/max-drake.cc\/data\/sheets\/indexFull.php\" target=\"_blank\" rel=\"noopener\">link<\/a><\/strong> to file I am talking about. Right click on the page and choose &#8220;View Page Source&#8221; and cut\/paste into text editor to explore.<\/p>\n<h3>Json output<\/h3>\n<p><img decoding=\"async\" class=\"wp-image-4299 aligncenter lazyload\" data-src=\"https:\/\/max-drake.cc\/wp-content\/uploads\/2018\/08\/im16.jpg\" alt=\"\" width=\"1013\" height=\"961\" data-srcset=\"https:\/\/max-drake.cc\/wp-content\/uploads\/2018\/08\/im16.jpg 866w, https:\/\/max-drake.cc\/wp-content\/uploads\/2018\/08\/im16-300x285.jpg 300w, https:\/\/max-drake.cc\/wp-content\/uploads\/2018\/08\/im16-768x729.jpg 768w\" data-sizes=\"(max-width: 1013px) 100vw, 1013px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 1013px; --smush-placeholder-aspect-ratio: 1013\/961;\" \/><\/p>\n<p>Initially I thought, I have JSON output, great. But didn&#8217;t look at it too closely. In fact, because of the spreadsheet layout the information in json is in an array, or rather an array in an array.<\/p>\n<p>If you look at the console output at the top level, it is called object:<\/p>\n<div class=\"tree object-inspector\" tabindex=\"0\" role=\"tree\">\n<div id=\"server1.conn3.child1\/obj47\" class=\"tree-node\" role=\"treeitem\" aria-level=\"1\" aria-expanded=\"false\" data-expandable=\"true\">\n<div class=\"node object-node\"><em><span class=\"objectBox objectBox-object\" data-link-actor-id=\"server1.conn3.child1\/obj47\"><strong><span class=\"objectTitle\">Object<\/span><\/strong><span class=\"objectLeftBrace\"> { <\/span><span class=\"nodeName\">range<\/span><span class=\"objectEqual\">: <\/span><span class=\"objectBox objectBox-string\">&#8220;DisplayData!A1:Z1000&#8221;<\/span>, <span class=\"nodeName\">majorDimension<\/span><span class=\"objectEqual\">: <\/span><span class=\"objectBox objectBox-string\">&#8220;ROWS&#8221;<\/span>, <span class=\"nodeName\">values<\/span><span class=\"objectEqual\">: <\/span><span class=\"objectBox objectBox-array\" data-link-actor-id=\"server1.conn3.child1\/obj48\"><span class=\"objectTitle\"><span class=\"objectLengthBubble\">(162)<\/span> <\/span><span class=\"arrayLeftBracket\">[<\/span><span class=\"more-ellipsis\" title=\"more\u2026\">\u2026<\/span><span class=\"arrayRightBracket\">]<\/span><\/span><span class=\"objectRightBrace\"> }<\/span><\/span><\/em><\/div>\n<div><\/div>\n<div>Next level down there are 3 items =\u00a0 <em><span class=\"tree-indent\">\u200b<\/span><span class=\"object-label\">majorDimension<\/span><\/em>, <em>range, values.<\/em><\/div>\n<div>The majorDimension and range both have one attribute each. The values has many attributes.<\/div>\n<\/div>\n<\/div>\n<div class=\"tree object-inspector\" tabindex=\"0\" role=\"tree\">\n<div id=\"Symbol(server1.conn3.child1\/obj47\/majorDimension)\" class=\"tree-node\" role=\"treeitem\" aria-level=\"2\" data-expandable=\"false\">\n<p><em><span class=\"tree-indent\">\u200b<\/span><span class=\"object-label\">majorDimension<\/span><span class=\"object-delimiter\">: <\/span><span class=\"objectBox objectBox-string\">&#8220;ROWS&#8221;<\/span><\/em><\/p>\n<\/div>\n<div id=\"Symbol(server1.conn3.child1\/obj47\/range)\" class=\"tree-node\" role=\"treeitem\" aria-level=\"2\" data-expandable=\"false\">\n<p><em><span class=\"tree-indent\">\u200b<\/span><span class=\"object-label\">range<\/span><span class=\"object-delimiter\">: <\/span><span class=\"objectBox objectBox-string\">&#8220;DisplayData!A1:Z1000&#8221;<\/span><\/em><\/p>\n<\/div>\n<div id=\"Symbol(server1.conn3.child1\/obj47\/values)\" class=\"tree-node\" role=\"treeitem\" aria-level=\"2\" aria-expanded=\"false\" data-expandable=\"true\">\n<p><em><span class=\"tree-indent\">\u200b<\/span><span class=\"object-label\">values<\/span><span class=\"object-delimiter\">: <\/span><span class=\"objectBox objectBox-array\" data-link-actor-id=\"server1.conn3.child1\/obj60\"><span class=\"objectTitle\">Array<span class=\"objectLengthBubble\">(162)<\/span><\/span><span class=\"arrayLeftBracket\">[ <\/span><span class=\"objectTitle\"><span class=\"objectLengthBubble\">(10)<\/span><\/span><span class=\"arrayLeftBracket\">[<\/span><span class=\"more-ellipsis\" title=\"more\u2026\">\u2026<\/span><span class=\"arrayRightBracket\">]<\/span>, <span class=\"objectTitle\"><span class=\"objectLengthBubble\">(10)<\/span><\/span><span class=\"arrayLeftBracket\">[<\/span><span class=\"more-ellipsis\" title=\"more\u2026\">\u2026<\/span><span class=\"arrayRightBracket\">]<\/span>, <span class=\"objectTitle\"><span class=\"objectLengthBubble\">(10)<\/span><\/span><span class=\"arrayLeftBracket\">[<\/span><span class=\"more-ellipsis\" title=\"more\u2026\">\u2026<\/span><span class=\"arrayRightBracket\">]<\/span>, <span class=\"more-ellipsis\" title=\"more\u2026\">\u2026<\/span><span class=\"arrayRightBracket\"><br \/>\n<\/span><\/span><\/em><\/p>\n<\/div>\n<\/div>\n<div>The values have 162 attributes, and they are grouped into 2 sets as you look at the data in the console window in the browser from [0&#8230;99] and from [100&#8230;161]. This is an array of values from 0 to 161<\/div>\n<div class=\"node object-node\">If we look at the [0&#8230;99] the first value 0: it too has an array <em><span class=\"object-label\">0<\/span><span class=\"object-delimiter\">: <\/span><span class=\"objectBox objectBox-array\" data-link-actor-id=\"server1.conn3.child1\/obj76\"><span class=\"objectTitle\">Array<span class=\"objectLengthBubble\">(10)<\/span> <\/span><\/span><\/em>, with 10 values, and so do all the rest of the first array, 1:,2:&#8230;..161:<\/div>\n<div class=\"node object-node\"><em><span class=\"object-label\">values<\/span><span class=\"object-delimiter\">: <\/span><span class=\"objectBox objectBox-array\" data-link-actor-id=\"server1.conn3.child1\/obj60\"><span class=\"objectTitle\"><span class=\"objectLengthBubble\">(162)<\/span> <\/span><span class=\"arrayLeftBracket\">[<\/span><span class=\"more-ellipsis\" title=\"more\u2026\">\u2026<\/span><span class=\"arrayRightBracket\">]<\/span><\/span><\/em><\/div>\n<div>\n<div id=\"Symbol(server1.conn3.child1\/obj47\/values\/[0\u202699])\" class=\"tree-node\" role=\"treeitem\" aria-level=\"3\" aria-expanded=\"true\" data-expandable=\"true\">\n<div class=\"node object-node\"><em><span class=\"object-label\">[0\u202699]<\/span><\/em><\/div>\n<\/div>\n<div id=\"Symbol(server1.conn3.child1\/obj47\/values\/[0\u202699]\/0)\" class=\"tree-node\" role=\"treeitem\" aria-level=\"4\" aria-expanded=\"false\" data-expandable=\"true\">\n<div class=\"node object-node\"><em><span class=\"object-label\">0<\/span><span class=\"object-delimiter\">: <\/span><span class=\"objectBox objectBox-array\" data-link-actor-id=\"server1.conn3.child1\/obj76\"><span class=\"objectTitle\">Array<span class=\"objectLengthBubble\">(10)<\/span> <\/span><span class=\"arrayLeftBracket\">[ <\/span><span class=\"objectBox objectBox-string\">&#8220;Code&#8221;<\/span>, <span class=\"objectBox objectBox-string\">&#8220;Company&#8221;<\/span>, <span class=\"objectBox objectBox-string\">&#8220;Price&#8221;<\/span>, <span class=\"more-ellipsis\" title=\"more\u2026\">\u2026<\/span><span class=\"arrayRightBracket\"> ]<\/span><\/span><\/em><\/div>\n<\/div>\n<div id=\"Symbol(server1.conn3.child1\/obj47\/values\/[0\u202699]\/1)\" class=\"tree-node\" role=\"treeitem\" aria-level=\"4\" aria-expanded=\"false\" data-expandable=\"true\">\n<div class=\"node object-node\"><em><span class=\"object-label\">1<\/span><span class=\"object-delimiter\">: <\/span><span class=\"objectBox objectBox-array\" data-link-actor-id=\"server1.conn3.child1\/obj77\"><span class=\"objectTitle\">Array<span class=\"objectLengthBubble\">(10)<\/span> <\/span><span class=\"arrayLeftBracket\">[ <\/span><span class=\"objectBox objectBox-string\">&#8220;ASB&#8221;<\/span>, <span class=\"objectBox objectBox-string\">&#8220;ASB Capital Limited (NS)&#8221;<\/span>, <span class=\"objectBox objectBox-string\">&#8220;$0.907&#8221;<\/span>, <span class=\"more-ellipsis\" title=\"more\u2026\">\u2026<\/span><span class=\"arrayRightBracket\"> ]<\/span><\/span><\/em><\/div>\n<\/div>\n<div id=\"Symbol(server1.conn3.child1\/obj47\/values\/[0\u202699]\/2)\" class=\"tree-node\" role=\"treeitem\" aria-level=\"4\" aria-expanded=\"false\" data-expandable=\"true\">\n<div class=\"node object-node\"><em><span class=\"object-label\">2<\/span><span class=\"object-delimiter\">: <\/span><span class=\"objectBox objectBox-array\" data-link-actor-id=\"server1.conn3.child1\/obj78\"><span class=\"objectTitle\">Array<span class=\"objectLengthBubble\">(10)<\/span> <\/span><span class=\"arrayLeftBracket\">[ <\/span><span class=\"objectBox objectBox-string\">&#8220;MCK&#8221;<\/span>, <span class=\"objectBox objectBox-string\">&#8220;Millennium &amp; Copthorne Hotels New Zealand Limited&#8221;<\/span>, <span class=\"objectBox objectBox-string\">&#8220;$3.360&#8221;<\/span>, <span class=\"more-ellipsis\" title=\"more\u2026\">\u2026<\/span><span class=\"arrayRightBracket\"> ]<\/span><\/span><\/em><\/div>\n<\/div>\n<\/div>\n<p>If we drill down further, looking at item 0: of the values: we see that it has values of 0: to 9:\u00a0 (so 10 values). At the end there is an item length:10 that tells you how many items there are in array values: 0:<\/p>\n<p>First. Values: 0: is the header column of the spreadsheet, so contains all the column headers (Row 1 in spreadsheet). Secondly, the following values: 1:, 2:, &#8230;..161\u00a0\u00a0 will all be the data rows.<\/p>\n<div id=\"Symbol(server1.conn3.child1\/obj47\/values)\" class=\"tree-node\" role=\"treeitem\" aria-level=\"2\" aria-expanded=\"true\" data-expandable=\"true\">\n<div class=\"node object-node\"><em><span class=\"object-label\">values<\/span><span class=\"object-delimiter\">: <\/span><span class=\"objectBox objectBox-array\" data-link-actor-id=\"server1.conn3.child1\/obj60\"><span class=\"objectTitle\"><span class=\"objectLengthBubble\">(162)<\/span> <\/span><span class=\"arrayLeftBracket\">[<\/span><span class=\"more-ellipsis\" title=\"more\u2026\">\u2026<\/span><span class=\"arrayRightBracket\">]<\/span><\/span><\/em><\/div>\n<\/div>\n<div id=\"Symbol(server1.conn3.child1\/obj47\/values\/[0\u202699])\" class=\"tree-node\" role=\"treeitem\" aria-level=\"3\" aria-expanded=\"true\" data-expandable=\"true\"><em><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"object-label\">[0\u202699]<\/span><\/em><\/div>\n<div id=\"Symbol(server1.conn3.child1\/obj47\/values\/[0\u202699]\/0)\" class=\"tree-node\" role=\"treeitem\" aria-level=\"4\" aria-expanded=\"true\" data-expandable=\"true\"><em><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"object-label\">0<\/span><span class=\"object-delimiter\">: <\/span><span class=\"objectBox objectBox-array\" data-link-actor-id=\"server1.conn3.child1\/obj76\"><span class=\"objectTitle\"><span class=\"objectLengthBubble\">(10)<\/span> <\/span><span class=\"arrayLeftBracket\">[<\/span><span class=\"more-ellipsis\" title=\"more\u2026\">\u2026<\/span><span class=\"arrayRightBracket\">]<\/span><\/span><\/em><\/div>\n<div id=\"Symbol(server1.conn3.child1\/obj47\/values\/[0\u202699]\/0\/0)\" class=\"tree-node\" role=\"treeitem\" aria-level=\"5\" data-expandable=\"false\"><em><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"object-label\">0<\/span><span class=\"object-delimiter\">: <\/span><span class=\"objectBox objectBox-string\">&#8220;Code&#8221;<\/span><\/em><\/div>\n<div id=\"Symbol(server1.conn3.child1\/obj47\/values\/[0\u202699]\/0\/1)\" class=\"tree-node\" role=\"treeitem\" aria-level=\"5\" data-expandable=\"false\"><em><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"object-label\">1<\/span><span class=\"object-delimiter\">: <\/span><span class=\"objectBox objectBox-string\">&#8220;Company&#8221;<\/span><\/em><\/div>\n<div id=\"Symbol(server1.conn3.child1\/obj47\/values\/[0\u202699]\/0\/2)\" class=\"tree-node\" role=\"treeitem\" aria-level=\"5\" data-expandable=\"false\"><em><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"object-label\">2<\/span><span class=\"object-delimiter\">: <\/span><span class=\"objectBox objectBox-string\">&#8220;Price&#8221;<\/span><\/em><\/div>\n<div id=\"Symbol(server1.conn3.child1\/obj47\/values\/[0\u202699]\/0\/3)\" class=\"tree-node\" role=\"treeitem\" aria-level=\"5\" data-expandable=\"false\"><em><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"object-label\">3<\/span><span class=\"object-delimiter\">: <\/span><span class=\"objectBox objectBox-string\">&#8220;Change&#8221;<\/span><\/em><\/div>\n<div id=\"Symbol(server1.conn3.child1\/obj47\/values\/[0\u202699]\/0\/4)\" class=\"tree-node\" role=\"treeitem\" aria-level=\"5\" data-expandable=\"false\"><em><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"object-label\">4<\/span><span class=\"object-delimiter\">: <\/span><span class=\"objectBox objectBox-string\">&#8220;Volume&#8221;<\/span><\/em><\/div>\n<div id=\"Symbol(server1.conn3.child1\/obj47\/values\/[0\u202699]\/0\/5)\" class=\"tree-node\" role=\"treeitem\" aria-level=\"5\" data-expandable=\"false\"><em><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"object-label\">5<\/span><span class=\"object-delimiter\">: <\/span><span class=\"objectBox objectBox-string\">&#8220;Value&#8221;<\/span><\/em><\/div>\n<div id=\"Symbol(server1.conn3.child1\/obj47\/values\/[0\u202699]\/0\/6)\" class=\"tree-node\" role=\"treeitem\" aria-level=\"5\" data-expandable=\"false\"><em><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"object-label\">6<\/span><span class=\"object-delimiter\">: <\/span><span class=\"objectBox objectBox-string\">&#8220;Capitalisation&#8221;<\/span><\/em><\/div>\n<div id=\"Symbol(server1.conn3.child1\/obj47\/values\/[0\u202699]\/0\/7)\" class=\"tree-node\" role=\"treeitem\" aria-level=\"5\" data-expandable=\"false\"><em><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"object-label\">7<\/span><span class=\"object-delimiter\">: <\/span><span class=\"objectBox objectBox-string\">&#8220;Percentage Change&#8221;<\/span><\/em><\/div>\n<div id=\"Symbol(server1.conn3.child1\/obj47\/values\/[0\u202699]\/0\/8)\" class=\"tree-node\" role=\"treeitem\" aria-level=\"5\" data-expandable=\"false\"><em><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"object-label\">8<\/span><span class=\"object-delimiter\">: <\/span><span class=\"objectBox objectBox-string\">&#8220;Type&#8221;<\/span><\/em><\/div>\n<div id=\"Symbol(server1.conn3.child1\/obj47\/values\/[0\u202699]\/0\/9)\" class=\"tree-node\" role=\"treeitem\" aria-level=\"5\" data-expandable=\"false\"><em><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"object-label\">9<\/span><span class=\"object-delimiter\">: <\/span><span class=\"objectBox objectBox-string\">&#8220;Green Bond&#8221;<\/span><\/em><\/div>\n<div id=\"Symbol(server1.conn3.child1\/obj47\/values\/[0\u202699]\/0\/length)\" class=\"tree-node\" role=\"treeitem\" aria-level=\"5\" data-expandable=\"false\"><em><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"object-label\">length<\/span><span class=\"object-delimiter\">: <\/span><span class=\"objectBox objectBox-number\">10<\/span><\/em><\/div>\n<div id=\"Symbol(server1.conn3.child1\/obj47\/values\/[0\u202699]\/0\/&lt;prototype&gt;)\" class=\"tree-node\" role=\"treeitem\" aria-level=\"5\" aria-expanded=\"false\" data-expandable=\"true\"><em><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"object-label\">&lt;prototype&gt;<\/span><span class=\"object-delimiter\">: <\/span><span class=\"objectBox objectBox-array\" data-link-actor-id=\"server1.conn3.child1\/obj182\"><span class=\"objectTitle\">Array <\/span><span class=\"arrayLeftBracket\">[<\/span><span class=\"arrayRightBracket\">]<\/span><\/span><\/em><\/div>\n<div id=\"Symbol(server1.conn3.child1\/obj47\/values\/[0\u202699]\/1)\" class=\"tree-node\" role=\"treeitem\" aria-level=\"4\" aria-expanded=\"false\" data-expandable=\"true\"><em><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span>1<span class=\"object-delimiter\">: <\/span><span class=\"objectBox objectBox-array\" data-link-actor-id=\"server1.conn3.child1\/obj77\"><span class=\"objectTitle\">Array<span class=\"objectLengthBubble\">(10)<\/span> <\/span><span class=\"arrayLeftBracket\">[ <\/span><span class=\"objectBox objectBox-string\">&#8220;ASB&#8221;<\/span>, <span class=\"objectBox objectBox-string\">&#8220;ASB Capital Limited (NS)&#8221;<\/span>, <span class=\"objectBox objectBox-string\">&#8220;$0.907&#8221;<\/span>, <span class=\"more-ellipsis\" title=\"more\u2026\">\u2026<\/span><span class=\"arrayRightBracket\"> ]<\/span><\/span><\/em><\/div>\n<div id=\"Symbol(server1.conn3.child1\/obj47\/values\/[0\u202699]\/2)\" class=\"tree-node\" role=\"treeitem\" aria-level=\"4\" aria-expanded=\"true\" data-expandable=\"true\"><em><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"object-label\">2<\/span><span class=\"object-delimiter\">: <\/span><span class=\"objectBox objectBox-array\" data-link-actor-id=\"server1.conn3.child1\/obj78\"><span class=\"objectTitle\"><span class=\"objectLengthBubble\">(10)<\/span> <\/span><span class=\"arrayLeftBracket\">[<\/span><span class=\"more-ellipsis\" title=\"more\u2026\">\u2026<\/span><span class=\"arrayRightBracket\">]<\/span><\/span><\/em><\/div>\n<div role=\"treeitem\" aria-level=\"4\" aria-expanded=\"true\" data-expandable=\"true\"><\/div>\n<div role=\"treeitem\" aria-level=\"4\" aria-expanded=\"true\" data-expandable=\"true\">So the Json file has 1. Top level object. 2nd level 3 items <em><span class=\"tree-indent\">\u200b<\/span><span class=\"object-label\">majorDimension<\/span><\/em>, <em>range, values. <\/em>And within the item:values there is an array of 162 items, and within that array for each item there is an array of 10 items .<\/div>\n<div role=\"treeitem\" aria-level=\"4\" aria-expanded=\"true\" data-expandable=\"true\">So rows are\u00a0 Object: values: [array 0 to 161]<\/div>\n<div role=\"treeitem\" aria-level=\"4\" aria-expanded=\"true\" data-expandable=\"true\">Columns are:<\/div>\n<div role=\"treeitem\" aria-level=\"4\" aria-expanded=\"true\" data-expandable=\"true\">Object: values: [array 0] [array 0 to 10]<\/div>\n<div role=\"treeitem\" aria-level=\"4\" aria-expanded=\"true\" data-expandable=\"true\">Object: values: [array 1] [array 0 to 10]<\/div>\n<div role=\"treeitem\" aria-level=\"4\" aria-expanded=\"true\" data-expandable=\"true\">Object: values: [array 2] [array 0 to 10] etc<\/div>\n<div role=\"treeitem\" aria-level=\"4\" aria-expanded=\"true\" data-expandable=\"true\"><\/div>\n<div role=\"treeitem\" aria-level=\"4\" aria-expanded=\"true\" data-expandable=\"true\">Now we know the json structure we can use javascript to go and grab the bits that we want. In the code that we are using there is a function:<\/div>\n<div role=\"treeitem\" aria-level=\"4\" aria-expanded=\"true\" data-expandable=\"true\">\n<p style=\"padding-left: 60px;\">function <strong>makeApiCall()<\/strong> {<br \/>\nvar params = {<br \/>\nspreadsheetId: &#8216;&#8230;.&#8217;, \/\/ TODO: Update placeholder value.<br \/>\nrange: &#8216;&#8230;&#8217;, \/\/ TODO: Update placeholder value. };<\/p>\n<p style=\"padding-left: 60px;\">var request = gapi.client.sheets.spreadsheets.values.get(params);<br \/>\nrequest.then(function(<strong>response<\/strong>) {<br \/>\n<strong>console.log(response.result)<\/strong>;\u00a0 \/\/ TODO: Change code to process the `response` object:<\/p>\n<p>The above console.log call takes the response.result object and displays it in the console. This is the JSON file output.<\/p>\n<p>So in the Json output at the top of the page the Object = response.result<\/p>\n<p>In javaScript you can use the .length to find a length of an array,. so to find this in the json file we have and write it to the screen we can use:<\/p>\n<p><em>\u00a0document.write(response.result.values.length );\u00a0\u00a0<\/em>\u00a0 [Give me the length of the array of\u00a0 Object: values: ]. This will tell us the number of rows (including header) in the spreadsheet<\/p>\n<p>We can also use:<\/p>\n<p><em>document.write(response.result.values[0].length );\u00a0\u00a0<\/em>[Give me the length of the array of\u00a0 Object: values: 0: ]. This will tell us the number of columns in the spreadsheet.<\/p>\n<p>So if we wanted to grab the value of the 2nd item of the 4th array (remember arrays start at 0, not 1) in the json file:<\/p>\n<div id=\"Symbol(server1.conn3.child1\/obj47\/values)\" class=\"tree-node\" role=\"treeitem\" aria-level=\"2\" aria-expanded=\"true\" data-expandable=\"true\"><span class=\"tree-indent\">\u200b<\/span><em><span class=\"object-label\">values<\/span><span class=\"object-delimiter\">: <\/span><span class=\"objectBox objectBox-array\" data-link-actor-id=\"server1.conn3.child1\/obj60\"><span class=\"objectTitle\"><span class=\"objectLengthBubble\">(162)<\/span><\/span><span class=\"arrayLeftBracket\">[<\/span><span class=\"more-ellipsis\" title=\"more\u2026\">\u2026<\/span><span class=\"arrayRightBracket\">]<\/span><\/span><\/em><\/div>\n<div id=\"Symbol(server1.conn3.child1\/obj47\/values\/[0\u202699])\" class=\"tree-node\" role=\"treeitem\" aria-level=\"3\" aria-expanded=\"true\" data-expandable=\"true\"><em><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"object-label\">[0\u202699]<\/span><\/em><\/div>\n<div id=\"Symbol(server1.conn3.child1\/obj47\/values\/[0\u202699]\/0)\" class=\"tree-node\" role=\"treeitem\" aria-level=\"4\" aria-expanded=\"false\" data-expandable=\"true\"><em><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"object-label\">0<\/span><span class=\"object-delimiter\">: <\/span><span class=\"objectBox objectBox-array\" data-link-actor-id=\"server1.conn3.child1\/obj76\"><span class=\"objectTitle\">Array<span class=\"objectLengthBubble\">(10)<\/span><\/span><span class=\"arrayLeftBracket\">[ <\/span><span class=\"objectBox objectBox-string\">&#8220;Code&#8221;<\/span>, <span class=\"objectBox objectBox-string\">&#8220;Company&#8221;<\/span>, <span class=\"objectBox objectBox-string\">&#8220;Price&#8221;<\/span>, <span class=\"more-ellipsis\" title=\"more\u2026\">\u2026<\/span><span class=\"arrayRightBracket\"> ]<\/span><\/span><\/em><\/div>\n<div id=\"Symbol(server1.conn3.child1\/obj47\/values\/[0\u202699]\/1)\" class=\"tree-node\" role=\"treeitem\" aria-level=\"4\" aria-expanded=\"false\" data-expandable=\"true\"><em><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"object-label\">1<\/span><span class=\"object-delimiter\">: <\/span><span class=\"objectBox objectBox-array\" data-link-actor-id=\"server1.conn3.child1\/obj77\"><span class=\"objectTitle\">Array<span class=\"objectLengthBubble\">(10)<\/span><\/span><span class=\"arrayLeftBracket\">[ <\/span><span class=\"objectBox objectBox-string\">&#8220;ASB&#8221;<\/span>, <span class=\"objectBox objectBox-string\">&#8220;ASB Capital Limited (NS)&#8221;<\/span>, <span class=\"objectBox objectBox-string\">&#8220;$0.907&#8221;<\/span>, <span class=\"more-ellipsis\" title=\"more\u2026\">\u2026<\/span><span class=\"arrayRightBracket\"> ]<\/span><\/span><\/em><\/div>\n<div id=\"Symbol(server1.conn3.child1\/obj47\/values\/[0\u202699]\/2)\" class=\"tree-node\" role=\"treeitem\" aria-level=\"4\" aria-expanded=\"false\" data-expandable=\"true\"><em><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"object-label\">2<\/span><span class=\"object-delimiter\">: <\/span><span class=\"objectBox objectBox-array\" data-link-actor-id=\"server1.conn3.child1\/obj78\"><span class=\"objectTitle\">Array<span class=\"objectLengthBubble\">(10)<\/span><\/span><span class=\"arrayLeftBracket\">[ <\/span><span class=\"objectBox objectBox-string\">&#8220;MCK&#8221;<\/span>, <span class=\"objectBox objectBox-string\">&#8220;Millennium &amp; Copthorne Hotels New Zealand Limited&#8221;<\/span>, <span class=\"objectBox objectBox-string\">&#8220;$3.360&#8221;<\/span>, <span class=\"more-ellipsis\" title=\"more\u2026\">\u2026<\/span><span class=\"arrayRightBracket\"> ]<\/span><\/span><\/em><\/div>\n<div id=\"Symbol(server1.conn3.child1\/obj47\/values\/[0\u202699]\/3)\" class=\"tree-node\" role=\"treeitem\" aria-level=\"4\" aria-expanded=\"true\" data-expandable=\"true\"><em><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"object-label\">3<\/span><span class=\"object-delimiter\">: <\/span><span class=\"objectBox objectBox-array\" data-link-actor-id=\"server1.conn3.child1\/obj79\"><span class=\"objectTitle\"><span class=\"objectLengthBubble\">(10)<\/span><\/span><span class=\"arrayLeftBracket\">[<\/span><span class=\"more-ellipsis\" title=\"more\u2026\">\u2026<\/span><span class=\"arrayRightBracket\">]<\/span><\/span><\/em><\/div>\n<div id=\"Symbol(server1.conn3.child1\/obj47\/values\/[0\u202699]\/3\/0)\" class=\"tree-node\" role=\"treeitem\" aria-level=\"5\" data-expandable=\"false\"><em><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"object-label\">0<\/span><span class=\"object-delimiter\">: <\/span><span class=\"objectBox objectBox-string\">&#8220;ASB&#8221;<\/span><\/em><\/div>\n<div id=\"Symbol(server1.conn3.child1\/obj47\/values\/[0\u202699]\/3\/1)\" class=\"tree-node\" role=\"treeitem\" aria-level=\"5\" data-expandable=\"false\"><em><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><strong><span class=\"object-label\">1<\/span><span class=\"object-delimiter\">: <\/span><span class=\"objectBox objectBox-string\">&#8220;ASB Capital Limited (NS)&#8221;<\/span><\/strong><\/em><\/div>\n<div id=\"Symbol(server1.conn3.child1\/obj47\/values\/[0\u202699]\/3\/2)\" class=\"tree-node\" role=\"treeitem\" aria-level=\"5\" data-expandable=\"false\"><em><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"object-label\">2<\/span><span class=\"object-delimiter\">: <\/span><span class=\"objectBox objectBox-string\">&#8220;$0.889&#8221;<\/span><\/em><\/div>\n<div id=\"Symbol(server1.conn3.child1\/obj47\/values\/[0\u202699]\/3\/3)\" class=\"tree-node\" role=\"treeitem\" aria-level=\"5\" data-expandable=\"false\"><em><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"object-label\">3<\/span><span class=\"object-delimiter\">: <\/span><span class=\"objectBox objectBox-string\">&#8220;-$0.004 \/ -0.45%&#8221;<\/span><\/em><\/div>\n<div id=\"Symbol(server1.conn3.child1\/obj47\/values\/[0\u202699]\/3\/4)\" class=\"tree-node\" role=\"treeitem\" aria-level=\"5\" data-expandable=\"false\"><em><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"object-label\">4<\/span><span class=\"object-delimiter\">: <\/span><span class=\"objectBox objectBox-string\">&#8220;120,000&#8221;<\/span><\/em><\/div>\n<div id=\"Symbol(server1.conn3.child1\/obj47\/values\/[0\u202699]\/3\/5)\" class=\"tree-node\" role=\"treeitem\" aria-level=\"5\" data-expandable=\"false\"><em><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"object-label\">5<\/span><span class=\"object-delimiter\">: <\/span><span class=\"objectBox objectBox-string\">&#8220;$106,680.00&#8221;<\/span><\/em><\/div>\n<div id=\"Symbol(server1.conn3.child1\/obj47\/values\/[0\u202699]\/3\/6)\" class=\"tree-node\" role=\"treeitem\" aria-level=\"5\" data-expandable=\"false\"><em><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"object-label\">6<\/span><span class=\"object-delimiter\">: <\/span><span class=\"objectBox objectBox-string\">&#8220;$311,150,000&#8221;<\/span><\/em><\/div>\n<div id=\"Symbol(server1.conn3.child1\/obj47\/values\/[0\u202699]\/3\/7)\" class=\"tree-node\" role=\"treeitem\" aria-level=\"5\" data-expandable=\"false\"><em><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"object-label\">7<\/span><span class=\"object-delimiter\">: <\/span><span class=\"objectBox objectBox-string\">&#8220;-0.4479283315&#8221;<\/span><\/em><\/div>\n<div id=\"Symbol(server1.conn3.child1\/obj47\/values\/[0\u202699]\/3\/8)\" class=\"tree-node\" role=\"treeitem\" aria-level=\"5\" data-expandable=\"false\"><em><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"object-label\">8<\/span><span class=\"object-delimiter\">: <\/span><span class=\"objectBox objectBox-string\">&#8220;HYBR&#8221;<\/span><\/em><\/div>\n<div id=\"Symbol(server1.conn3.child1\/obj47\/values\/[0\u202699]\/3\/9)\" class=\"tree-node\" role=\"treeitem\" aria-level=\"5\" data-expandable=\"false\"><em><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"tree-indent\">\u200b<\/span><span class=\"object-label\">9<\/span><span class=\"object-delimiter\">: <\/span><span class=\"objectBox objectBox-string\">&#8220;FALSE&#8221;<\/span><\/em><\/div>\n<p>then in javascript we would write:<\/p>\n<p><em>\u00a0document.write(response.result.values[3][1])<\/em><\/p>\n<p>This would give us the 2nd value of the array within the 4th array\u00a0 of values. Which would be <em><strong><span class=\"objectBox objectBox-string\">&#8220;ASB Capital Limited (NS)&#8221;<\/span><\/strong><\/em>.<\/p>\n<h3>Looping<\/h3>\n<p>In the tutorial, instead of using console.log(response.result);\u00a0 a new function\u00a0\u00a0 populateSheet(response.result); is added. If we look at the function that is added:<\/p>\n<p><em>function <strong>populateSheet(result)<\/strong> {<\/em><br \/>\n<em>for(var row=0; row&lt;8; row++) {<\/em><br \/>\n<em>for(var col=0; col&lt;3; col++) {<\/em><br \/>\n<em>document.getElementById(row+&#8221;:&#8221;+col).value = result.values[row][col];}}}<\/em><\/p>\n<p>The code takes the result object and loops (iterates through, starting from 0 to 2 (col&lt;3), so in english columns 1,2,3) through the columns (inner for loop- 3rd line of code) then rows (outer for loop-2nd line of code) and pushes these results out as a table.<\/p>\n<p>row 0: col 0, row 0: col1, row 0:col2<\/p>\n<p>row 1: col 0, row 1: col1, row 1:col2<\/p>\n<p>row 2: col 0, row 2: col1, row 2:col2 etc<\/p>\n<\/div>\n<p>which would give example results from a table with 3 columns and 3 rows :<\/p>\n<table dir=\"ltr\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<colgroup>\n<col width=\"100\" \/>\n<col width=\"100\" \/>\n<col width=\"100\" \/><\/colgroup>\n<tbody>\n<tr>\n<td data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;Id&quot;}\">Id<\/td>\n<td data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;Name&quot;}\">Name<\/td>\n<td data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;Where&quot;}\">Where<\/td>\n<\/tr>\n<tr>\n<td data-sheets-value=\"{&quot;1&quot;:3,&quot;3&quot;:1}\">1<\/td>\n<td data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;Max&quot;}\">Cat<\/td>\n<td data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;Wello&quot;}\">Wellington<\/td>\n<\/tr>\n<tr>\n<td data-sheets-value=\"{&quot;1&quot;:3,&quot;3&quot;:2}\">2<\/td>\n<td data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;Jo&quot;}\">Dog<\/td>\n<td data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;Auckland&quot;}\">Auckland<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>So the function gets given a json file and it loops through it.<\/p>\n<p>How big is the JSON file? If you tried using this code on the json output we have which has 10 columns and 162 rows it would get confused and break as it would read the first 3 columns\u00a0 from row 0 correctly and then\u00a0 would try and read the\u00a0 first column of row 1, but the next item in the json array would be column 3 row 0, so it would stop and break.<\/p>\n<p>So we need a way of making sure we have the correct length of the arrays (cols and rows) to feed into the loops of the function, then it won&#8217;t break, whatever shape json file array we give it, so we change the code in the function to this:<\/p>\n<div role=\"treeitem\" aria-level=\"4\" aria-expanded=\"true\" data-expandable=\"true\">\n<p><em>function populateSheet(result) {<\/em><br \/>\n<em>for(var row=0; <strong>row&lt;result.values.length<\/strong>; row++) {<\/em><br \/>\n<em>for(var col=0; col&lt;<strong>result.values[0].length;<\/strong> col++) {<\/em><br \/>\n<em>document.getElementById(row+&#8221;:&#8221;+col).value = result.values[row][col];}}}<\/em><\/p>\n<h3>PHP Grid code<\/h3>\n<p>The other additional code in the tutorial has some PHP code:<\/p>\n<p><em>&lt;div style=&#8221;margin-left:auto; margin-right:auto; width:1960px;&#8221;&gt;<\/em><br \/>\n<em>&lt;?php<\/em><br \/>\n<em>for($row = 0; <strong>$row &lt; 8;<\/strong> $row++) {<\/em><br \/>\n<em>echo &#8220;&lt;div style=&#8217;clear:both&#8217;&gt;&#8221;;<\/em><br \/>\n<em>for($col = 0; <strong>$col &lt; 3<\/strong>; $col++) {<\/em><br \/>\n<em>echo &#8220;&lt;input type=&#8217;text&#8217; style=&#8217;float:left;&#8217; name = &#8216;$row:$col&#8217; id=&#8217;$row:$col&#8217;&gt;&#8221;;}<\/em><br \/>\n<em>echo &#8220;&lt;\/div&gt;&#8221;;} ?&gt;<\/em><\/p>\n<\/div>\n<div role=\"treeitem\" aria-level=\"4\" aria-expanded=\"true\" data-expandable=\"true\">This bit of code creates the table grid on the web page which is subsequently populated by the javascript. If you copy\/paste this code to the original code without adding\u00a0 any of the <em>function populateSheet(result)<\/em> code you&#8217;ll find the grids drawn on the screen with blank cells.<\/div>\n<div role=\"treeitem\" aria-level=\"4\" aria-expanded=\"true\" data-expandable=\"true\">I don&#8217;t quite understand how this part of the code works (I cannot see anything in the html code about border (drawing border around the cells).<\/div>\n<div role=\"treeitem\" aria-level=\"4\" aria-expanded=\"true\" data-expandable=\"true\">Anyway, again it has fixed numbers for rows and columns to iterate through $row&lt;8, $col&lt;3.<\/div>\n<div role=\"treeitem\" aria-level=\"4\" aria-expanded=\"true\" data-expandable=\"true\">Initially I thought, how do I take the javascript code to find lengt5hs of rows and columns of the json array and pass it to the PHP code and then started to look at the relation of php and javascript.<\/div>\n<div role=\"treeitem\" aria-level=\"4\" aria-expanded=\"true\" data-expandable=\"true\">PHP is activated on the server side, so happens first. Then the javascript is called on the client side ( on your computer) so happens afterwards. So if you want to use the javascript to pass something to the PHP you have to go : PHP then Javascript, pass to PHP then do PHP again, then I think javascript ( may be able to do Ajax at some point instead of PHP), but it all sounded complicated.<\/div>\n<div role=\"treeitem\" aria-level=\"4\" aria-expanded=\"true\" data-expandable=\"true\">Then I thought, wait a minute, we know the size of the spreadsheet that we are calling from Sheets, so we can just put the fixed length in.<\/div>\n<div role=\"treeitem\" aria-level=\"4\" aria-expanded=\"true\" data-expandable=\"true\">So no need to find length of array, that is known. We can count on the spreadsheet column\u00a0 numbers and row numbers. We just need to put these numbers in to the code when we are putting in the spreadsheetId and range etc when we are setting up the code.<\/div>\n<h3 role=\"treeitem\" aria-level=\"4\" aria-expanded=\"true\" data-expandable=\"true\">Results<\/h3>\n<p>If you look on this page : G<a href=\"https:\/\/max-drake.cc\/googlesheets-data-from-web-table-displayed-in-web-page-with-table-automatic-update\/\" target=\"_blank\" rel=\"noopener\">oogleSheets data from Web Table displayed in Web Page with Table automatic update<\/a> you will see table frame.<\/p>\n<p>I am having a few issues with the data being displayed. Its the sign in issue.<\/p>\n<p>So I am still having issues with accessing the data from the spreadsheet even though I have made the spreadsheet public and accessible to the web. I still have to work through those issues. I have found this site about <a href=\"https:\/\/developers.google.com\/oauthplayground\/\" target=\"_blank\" rel=\"noopener\"><strong>Auth2 Google playground<\/strong><\/a> that I will explore to see if it can help me.<\/p>\n<p><img decoding=\"async\" class=\"wp-image-4297 aligncenter lazyload\" data-src=\"https:\/\/max-drake.cc\/wp-content\/uploads\/2018\/08\/im15-853x1024.jpg\" alt=\"\" width=\"1457\" height=\"1749\" data-srcset=\"https:\/\/max-drake.cc\/wp-content\/uploads\/2018\/08\/im15-853x1024.jpg 853w, https:\/\/max-drake.cc\/wp-content\/uploads\/2018\/08\/im15-250x300.jpg 250w, https:\/\/max-drake.cc\/wp-content\/uploads\/2018\/08\/im15-768x922.jpg 768w, https:\/\/max-drake.cc\/wp-content\/uploads\/2018\/08\/im15.jpg 1400w\" data-sizes=\"(max-width: 1457px) 100vw, 1457px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 1457px; --smush-placeholder-aspect-ratio: 1457\/1749;\" \/><\/p>\n<p>I put the buttons (Sign In\/Sign Out) back in and tried to test from my mobile phone but the buttons aren&#8217;t working on that. All a bit of a challenge.<\/p>\n<p>From the last post\u00a0 <a title=\"Web Data3- Part 1. Google Sheets API to Web Page\" href=\"https:\/\/max-drake.cc\/2018\/08\/06\/web-data3-part-1-google-sheets-api-to-web-page\/\" rel=\"bookmark\">Web Data3- Part 1. Google Sheets API to Web Page<\/a> I wanted to do 3 things, I have got the code working,\u00a0 but I still have an issue of login.<\/p>\n<p>I will stop here at this point, still having the login issue.\u00a0 I want to go on and look at updating Google Sheets from the web.<\/p>\n<h4>PHP code in WordPress on post\/page<\/h4>\n<p>I wanted to make a page to demonstrate the process (see image and link above that is partially working).<\/p>\n<p>WordPress does not seem to allow you to put raw php code on a post or page.\u00a0 Another challenge to the process.<\/p>\n<p>I did find an article <a href=\"https:\/\/firstsiteguide.com\/run-php-code-directly-wordpress-posts-pages\/\" target=\"_blank\" rel=\"noopener\"><strong>How to run PHP code directly from WordPress posts and pages<\/strong><\/a> on this. The actual plugin they suggested I couldn&#8217;t find but I used <strong>PHP code snippets (Insert PHP)<\/strong> where you add a shortcode to your page and that works fine.<\/p>\n<h3>End Comment<\/h3>\n<p>Yes, data is displayed on the web page from Google Sheets. Unfortunately with this tutorial it is static, and has a fixed order. There is no highlighting of Column headers nor is there any formatting.<\/p>\n<p>The share market data that I\u00a0 am displaying needs to be sorted to be able to be explored.<\/p>\n<p>The solution is to look at JQuery dataTables which will allow for some formatting and sorting. That is another exercise. The failure issues I highlighted in Part 1 of this process showed dataTables displaying information from Google Sheets, so it is possible. I hope to show on the page where I am displaying current output GoogleSheets data from Web Table displayed in Web Page with Table automatic update the two types of outputs, but that is for another day.\u00a0 DataTable example <a href=\"https:\/\/max-drake.cc\/2018\/06\/17\/100-posts\/\" target=\"_blank\" rel=\"noopener\"><strong>here<\/strong><\/a>.<\/p>\n<p>I have been talking to a friend about doing 360 panorama images with hotspots and publishing them. I have done this using Python, see\u00a0\u00a0<a href=\"https:\/\/max-drake.cc\/2018\/05\/14\/panorama-file-hotspot-setup-using-free-photo-sphere-viewer-plan-link-tabs\/\" target=\"_blank\" rel=\"noopener\"><strong>Panorama file Hotspot setup using FREE Photo Sphere Viewer, plan link &amp; tabs<\/strong><\/a>\u00a0 and <strong><a title=\"Python 6. How to automate the creation of HTML pages for 360 Panorama\u2019s\" href=\"https:\/\/max-drake.cc\/2018\/05\/14\/python-6-creating-html-pages-for-360-panorama-files\/\" rel=\"bookmark\">Python 6. How to automate the creation of HTML pages for 360 Panorama\u2019s\u00a0<\/a><\/strong>.<\/p>\n<p>We have been discussing if there was a simple process to get users to be able to put these into the photos themselves. The friend suggested a web page solution, I proposed a Spreadsheet solution:<\/p>\n<p><em>The outline of the process would look like:<\/em><\/p>\n<p><em>Excel Macro templates (similar to my 3DPDF to tables Macro). As most people will be comfortable with Excel. <\/em><\/p>\n<ol>\n<li><em>\u00a0Will need a setup directory for the photos and a sub-directory with all the panorama viewer code. <\/em><\/li>\n<li><em>Will need to have a CSV\/Excel file with names\/directory\u00a0 of photos. (Note, these most probably\u00a0 need to be renamed- this can be done with Excel &amp; windows CMD ( a process can be done: <a class=\"moz-txt-link-freetext\" href=\"https:\/\/benholland.me\/tutorials\/2011\/11\/11\/rename-multiple-files-using-excel-in-windows.html\">https:\/\/benholland.me\/tutorials\/2011\/11\/11\/rename-multiple-files-using-excel-in-windows.html<\/a>)<\/em><\/li>\n<li><em>Will have to load the file to view of the image that they want to put the link into ( eg view in Paint to get\u00a0 x\/y coordinates of where the hotspot to go) <\/em><\/li>\n<li><em>Then the Target\u00a0 location &amp; the Hyperlink (to the proposed photo- I think realistically, it has to be part of the set in the specific directory) will needed to be added ( Can have columns for this in Excel Macro)<\/em><\/li>\n<li><em>There may be multiple links from one photo (eg A hall to lots of units), so have to make provision for multiple links)<\/em><\/li>\n<li><em>Then automate process of creating HTML file for the photo&#8217;s. ( Can be done in Excel &#8211; <a class=\"moz-txt-link-freetext\" href=\"http:\/\/www.meadinkent.co.uk\/xladvhtml.htm\">http:\/\/www.meadinkent.co.uk\/xladvhtml.htm<\/a>)<\/em><\/li>\n<li><em>These need to be processed so that they all end up in the same directory so you can Zip them up and share the whole package.<\/em><\/li>\n<\/ol>\n<p>Maybe the Google Sheets to Web, if bi-directional, can be a web &amp; spreadsheet solution. So I want to explore the updating Google Sheets from the web as per <a href=\"https:\/\/www.youtube.com\/channel\/UCm5pREiVM6hwsZKqJww8XuA\" target=\"_blank\" rel=\"noopener\">Anthony Brunson\u2019s tutorial\u00a0<\/a>number 3. This is the next exercise I want to stuff up.<\/p>\n<p>So what is still outstanding is Login Issues for accessing Data on the web, even with public sheets &amp; setting up JQuery dataTables.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I like it when I find some useful code and it works straight away. When it doesn&#8217;t I end up spending an awful lot of time trying to figure out what is happening. turning the programmers dark magic into something comprehensible. Continuing on from the previous post I started to look at the output and [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":4297,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[35,3,32,29],"tags":[],"class_list":["post-4295","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-api_json","category-data-extraction","category-power-bi","category-web"],"featured_image_src":"https:\/\/max-drake.cc\/wp-content\/uploads\/2018\/08\/im15.jpg","featured_image_src_square":"https:\/\/max-drake.cc\/wp-content\/uploads\/2018\/08\/im15.jpg","author_info":{"display_name":"Max Drake","author_link":"https:\/\/max-drake.cc\/?author=1"},"_links":{"self":[{"href":"https:\/\/max-drake.cc\/index.php?rest_route=\/wp\/v2\/posts\/4295","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/max-drake.cc\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/max-drake.cc\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/max-drake.cc\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/max-drake.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4295"}],"version-history":[{"count":0,"href":"https:\/\/max-drake.cc\/index.php?rest_route=\/wp\/v2\/posts\/4295\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/max-drake.cc\/index.php?rest_route=\/wp\/v2\/media\/4297"}],"wp:attachment":[{"href":"https:\/\/max-drake.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4295"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/max-drake.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4295"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/max-drake.cc\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4295"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}