Skip to content

How to Use Google sheet as Database for Dynamic Website

Shanaya Saxena 1 min read
google sheet database

Introduction

Google Sheets is one to the most handy tools we use in our daily life. We often use it for various purpose including Accounts, Employees Data etc.

Make the spreadsheet public

How to Use the Opensheet API

https://opensheet.elk.sh/spreadsheet_id/sheet_name

You can easily copy the spreadsheet_id from the URL of the Google sheet.

PHP Code Example to Print Spreadsheet data into HTML Table

<?php
    echo '<table>';
    $data = json_decode(file_get_contents("https://opensheet.elk.sh/1o5t26He2DzTweYeleXOGiDjlU4Jkx896f95VUHVgS8U/1"));
    foreach($data as $row){
        echo '<tr>';
            foreach($row as $column){
             echo '<td>'.$column.'</td>'  ; 
            }

          echo '</tr>';  
    }
echo '</table>';
?>

Shanaya Saxena

Empowering Developers with Years of Coding Experience

Keep reading