title: Using Google Sheets as a database?
body: <p>I would like to create a very simple PHP page for a site, which would show a timetable / calendar like data, where each slot would be either free or would have some appointment in it.</p>
  <p>Because all the data is actually just one table, something like {month, day, hour, talk_name, talk_description}, I thought why not use a Google Sheets Spreadsheet as the database. OK, the main reason is that I'm just reading books about how to use MySQL in PHP, so I'm definitely not on a level to:</p>
  <ul>
  <li>create a nice admin interface for managing the events</li>
  <li>make the whole thing safe (I mean all my idea about safety is to use .htaccess for an admin folder and make the site read-only elsewhere).</li>
  </ul>
  <p>On the other hand everyone could use Google spreadsheets for editing the table, so this way both the security aspects and the UI aspects would be solved.</p>
  <p>My question is that how would you recommend me to do that? Google Sheets can both publish in XML and CSV formats. Can I just use <code>fgetcsv</code> to get the data? Can you give me some simple examples how to parse the csv, and if it would be efficient (ok, it will be less than 50 views a day), if I would do something like this (sorry for the abstract syntax)?</p>
  <pre><code>$source_csv = fgetcsv(...);
  
  get_talk_name(x,y,z) {
    for all rows in $source_csv {
      if (month == x &amp;&amp; day == y &amp;&amp; hour == z) return talk_name
    }
  }
  
  get_talk_desc(x,y,z) {
    for all rows in $source_csv {
      if (month == x &amp;&amp; day == y &amp;&amp; hour == z) return talk_name
    }
  }
  </code></pre>