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

This package is auto-updated.

Last update: 2024-11-14 05:01:46 UTC


README

Current version Packagist PHP Version Support Monthly Downloads Total Downloads Stars

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();