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>';
?>
« How to Create Single Page Application in Laravel and Inertia JS Top 5 Highest Paid Jobs in Frontend Development [2022] »