maatify / google-sheet
Official PHP library for maatify.dev Google Sheet handler, known by our team
1.1.4
2023-11-06 06:21 UTC
Requires
- php: >=8.0
- google/apiclient: ^2.15
- maatify/logger: ^1.0
README
GoogleSheet
maatify.dev Google Sheet handler, read and write to google sheet, known by our team
Installation
composer require maatify/google-sheet
Usage 1- Create Class
<?php namespace GoogleSheet; use Maatify\GoogleSheet\SheetHandler; class GSheet extends SheetHandler { protected string $credentials_file = __DIR__ . 'Json credintals location', $spread_sheet_Id = 'sheet id 1uxGes9CR1mvdshgsdfhg', $spread_sheet_range = 'sheet!A:Z'; private static self $instance; public static function obj(): self { if(empty(self::$instance)) { self::$instance = new self(); } return self::$instance; } }
- to read sheet as array
GoogleSheet\GSheet::obj()->ReadAll();
- to insert array to row
GoogleSheet\GSheet::obj()->WriteRow();