PHP code example of aigorlaxy / google-sheets-model-importer

1. Go to this page and download the library: Download aigorlaxy/google-sheets-model-importer library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

aigorlaxy / google-sheets-model-importer example snippets


Use GoogleSheetsImportable.

$model = User::class;
$googleSpreadSheetId = '1gaLFuSnh20kggxEaasr511s15vt3olKqp9o12HenDLI3vA7pg';
$sheetId = '15144122';

$model::getFreshTableFromGoogleSheets($spreadsheetId, $sheetIds); // Truncate the current table and inserting the new data.
$model::updateOrCreateFromGoogleSheets($spreadsheetId, $sheetIds); // Updating and inserting new data.