GithubHelp home page GithubHelp logo

emilianozublena / sheetsu-php Goto Github PK

View Code? Open in Web Editor NEW
8.0 2.0 8.0 1.04 MB

PHP Library for Sheetsu API

License: GNU General Public License v3.0

PHP 100.00%
sheetsu sheetsu-php php-library google-spreadsheets api-service

sheetsu-php's Introduction

Hi there πŸ‘‹

IΚΌm Emiliano Zublena, a passionate Software Engineer native from Argentina. I have been creating software since 15yrs old πŸ”ž , started with Basic, Dolphin, Pascal and the likes, moved to the PHP world, danced with Javascript(and NodeJS) and currently in an intense love relationship with Golang -which if you haven't tried, i soooo urge you to try it-

  • πŸ†“ Started working as a freelance/consultant and building teams for startups in Argentina
  • πŸ‘₯ Co-founded my startup (Nubazon) which provided a SaaS for building e-commerce websites for small entrepreneurs
  • πŸ—½ Moved into the international market, where i've worked mainly on backend roles.
  • πŸ‘« I'm a team player guy, or so my team mates say i am
  • 🧠 I have an attitude of knowledge-sharing and mentoring
  • πŸ†• I love to deep dive into new technologies and/or research on cutting edge tech stacks for solving problems in the best way we can
  • πŸ‘· Currently i'm Software Architect @Morsum, a New York based company.
  • πŸ‘ And also contributing to:
  • πŸ“° I like to write articles of whatever it is that i'm learning -either tech related or not- in my medium account
  • πŸ“§ Reach me at [email protected] or connect with me at LinkedIn

sheetsu-php's People

Contributors

anasmostefaoui avatar emilianozublena avatar erbear avatar jdrzj avatar jon1010hill avatar mikgry avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

sheetsu-php's Issues

Create single element from array does not work

Hey,
At docs I can see that I can create single row with one-dimension array:

# Adds single row from array
$sheetsu->create(['name' => 'John']);

But the above code does not work. I see that the request sends:
"{"rows":{"name":"John"}}"
And it is not correct. Rows should be wrapped in an array:
"{"rows":[{"name":"John"}}]"
Or for the single row, the rows key should be omitted:
"{"name":"John"}"

what is sheetId?

Is sheetId a complete url like docs?

$sheetsu = new Sheetsu([
    'sheetId' => 'https://sheetsu.com/apis/v1.0dp/020b2c0f'
]);

or is it

$sheetsu = new Sheetsu([
    'sheetId' => '020b2c0f'
]);

With multiple request only the first works

Hey,

Please look at the below example:

<?php
require('vendor/autoload.php');
use Sheetsu\Sheetsu;

$sheetsu = new Sheetsu([
    'sheetId' => '020b2c0f'
]);

echo var_dump($sheetsu->read(2, 0));
echo var_dump($sheetsu->read(1, 0));
?>

It seems that the $sheetsu or $response objects are not cleared before next request. I've got the result below:

object(Sheetsu\Response)#5 (2) {
  ["http":"Sheetsu\Response":private]=>
  object(Curl\Curl)#4 (16) {
    ["_cookies":"Curl\Curl":private]=>
    array(0) {
    }
    ["_headers":"Curl\Curl":private]=>
    array(0) {
    }
    ["curl"]=>
    resource(12) of type (curl)
    ["error"]=>
    bool(false)
    ["error_code"]=>
    int(0)
    ["error_message"]=>
    string(0) ""
    ["curl_error"]=>
    bool(false)
    ["curl_error_code"]=>
    int(0)
    ["curl_error_message"]=>
    string(0) ""
    ["http_error"]=>
    bool(false)
    ["http_status_code"]=>
    int(200)
    ["http_error_message"]=>
    string(0) ""
    ["request_headers"]=>
    array(4) {
      [0]=>
      string(41) "GET /apis/v1.0/020b2c0f/?limit=2 HTTP/1.1"
      [1]=>
      string(17) "Host: sheetsu.com"
      [2]=>
      string(59) "User-Agent: PHP Curl/1.6 (+https://github.com/php-mod/curl)"
      [3]=>
      string(11) "Accept: */*"
    }
    ["response_headers"]=>
    array(12) {
      [0]=>
      string(15) "HTTP/1.1 200 OK"
      [1]=>
      string(13) "Server: nginx"
      [2]=>
      string(35) "Date: Mon, 13 Nov 2017 10:12:35 GMT"
      [3]=>
      string(44) "Content-Type: application/json;charset=UTF-8"
      [4]=>
      string(18) "Content-Length: 78"
      [5]=>
      string(22) "Connection: keep-alive"
      [6]=>
      string(42) "ETag: W/"72bb46c5a9e8a588e4139f3896569cfd""
      [7]=>
      string(50) "Cache-Control: max-age=0, private, must-revalidate"
      [8]=>
      string(50) "X-Request-Id: 27590baf-937f-4cc7-ba1e-8c6c07ed46df"
      [9]=>
      string(19) "X-Runtime: 1.011954"
      [10]=>
      string(12) "Vary: Origin"
      [11]=>
      string(43) "Strict-Transport-Security: max-age=15768000"
    }
    ["response"]=>
    string(78) "[{"id":"1","name":"Peter","score":"42"},{"id":"2","name":"Lois","score":"89"}]"
    ["response_header_continue":protected]=>
    bool(false)
  }
  ["errorHandler":"Sheetsu\Response":private]=>
  NULL
}


object(Sheetsu\Response)#5 (2) {
  ["http":"Sheetsu\Response":private]=>
  object(Curl\Curl)#4 (16) {
    ["_cookies":"Curl\Curl":private]=>
    array(0) {
    }
    ["_headers":"Curl\Curl":private]=>
    array(0) {
    }
    ["curl"]=>
    resource(12) of type (curl)
    ["error"]=>
    bool(false)
    ["error_code"]=>
    int(0)
    ["error_message"]=>
    string(0) ""
    ["curl_error"]=>
    bool(false)
    ["curl_error_code"]=>
    int(0)
    ["curl_error_message"]=>
    string(0) ""
    ["http_error"]=>
    bool(false)
    ["http_status_code"]=>
    int(200)
    ["http_error_message"]=>
    string(0) ""
    ["request_headers"]=>
    array(4) {
      [0]=>
      string(50) "GET /apis/v1.0/020b2c0f/?limit=2/?limit=1 HTTP/1.1"
      [1]=>
      string(17) "Host: sheetsu.com"
      [2]=>
      string(59) "User-Agent: PHP Curl/1.6 (+https://github.com/php-mod/curl)"
      [3]=>
      string(11) "Accept: */*"
    }
    ["response_headers"]=>
    array(12) {
      [0]=>
      string(15) "HTTP/1.1 200 OK"
      [1]=>
      string(13) "Server: nginx"
      [2]=>
      string(35) "Date: Mon, 13 Nov 2017 10:12:37 GMT"
      [3]=>
      string(44) "Content-Type: application/json;charset=UTF-8"
      [4]=>
      string(18) "Content-Length: 78"
      [5]=>
      string(22) "Connection: keep-alive"
      [6]=>
      string(42) "ETag: W/"72bb46c5a9e8a588e4139f3896569cfd""
      [7]=>
      string(50) "Cache-Control: max-age=0, private, must-revalidate"
      [8]=>
      string(50) "X-Request-Id: 6ab1a16c-a7b9-41b9-b765-a7d474b9f2fe"
      [9]=>
      string(19) "X-Runtime: 1.093165"
      [10]=>
      string(12) "Vary: Origin"
      [11]=>
      string(43) "Strict-Transport-Security: max-age=15768000"
    }
    ["response"]=>
    string(78) "[{"id":"1","name":"Peter","score":"42"},{"id":"2","name":"Lois","score":"89"}]"
    ["response_header_continue":protected]=>
    bool(false)
  }
  ["errorHandler":"Sheetsu\Response":private]=>
  NULL
}

As you can see the second request GET /apis/v1.0/020b2c0f/?limit=2/?limit=1 HTTP/1.1 keeps parameters of the first request and the response of the second request is equal to the first one, but it should be diffrent. I think the params should be cleared before next request.

Change Active Sheet does not work

Hello,

I've tried read data from the second worksheet:

<?php

require('vendor/autoload.php');
use Sheetsu\Sheetsu;

$sheetsu = new Sheetsu([
    'sheetId' => 'SHEET_ID'
]);

$response = $sheetsu->sheet('Sheet2')->read();
$collection = $response->getCollection();

echo $collection->_prepareCollectionToJson();

?>

I've got an empty collection, but I have data in my worksheet 'Sheet2'. Could you tell me what I'm doing wrong?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.