Advertisement
mrScarlett

NoticeBoard

Oct 12th, 2021
1,161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 1.25 KB | None | 0 0
  1. <!doctype html>
  2. <html lang="en-us">
  3.   <head>
  4.     <title>Untitled.</title>
  5.     <meta charset="utf-8">
  6.     <meta name="viewport" content="width=device-width, initial-scale=1">
  7.     <meta name="mobile-web-app-capable" content="yes">
  8.     <meta name="description" content="Blank HTML file for you to create something.">
  9.     <script src="https://cdn.rawgit.com/Keyang/node-csvtojson/d41f44aa/browser/csvtojson.min.js"></script>
  10.     <style>
  11.       body { max-width: 800px; width: 100%; margin: 1em auto; font-size: 2em; }
  12.     </style>
  13.    
  14.   </head>
  15.   <body>
  16.     <main></main>
  17.   </body>
  18.   <script>
  19.     const url="https://docs.google.com/spreadsheets/d/112VURHswSYyoMyu9HQo1ZlVA-adYUCdsNMbpnBsmndM/export?format=csv";
  20.     const main = document.querySelector("main");//div ID possibily
  21.    // main.innerHTML = "<p>Loading...</p>";
  22.     fetch(url).then(result=>result.text()).then(function(csvtext){
  23.         return csv().fromString(csvtext);
  24.     }).then(function(csv){
  25.        //main.innerHTML = "<code>" +JSON.stringify(csv)+"</code>";
  26.       csv.forEach(function(row){
  27.         main.innerHTML += "<h2>" +row.week + "</h2>";
  28.         main.innerHTML += "<h3>" +row.title + "</h3>";
  29.         main.innerHTML += "<p>" +row.detail + "</p>";
  30.     });
  31.     });
  32.   </script>
  33. </html>
  34.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement