From 348dc423730971be1d990517d80b224982b0ed27 Mon Sep 17 00:00:00 2001 From: michaeldchin Date: Tue, 26 Oct 2021 16:29:05 -0500 Subject: [PATCH] adding addColumn(s) and deleteAllSummaryFields --- src/Resources/Sheet.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/Resources/Sheet.php b/src/Resources/Sheet.php index 3ea5b1e..129ba83 100644 --- a/src/Resources/Sheet.php +++ b/src/Resources/Sheet.php @@ -332,6 +332,18 @@ public function getColumns(): array return $this->columns; } + public function addColumn(array $column) + { + return $this->addColumns([$column]); + } + + public function addColumns(array $column) + { + return $this->client->post("sheets/$this->id/columns", [ + 'json' => $column + ]); + } + public function addSummaryField(String $title, String $formula, String $type = 'TEXT_NUMBER') { $options = [ @@ -360,4 +372,13 @@ public function deleteSummaryField(String $fieldId) { return $this->deleteSummaryFields([$fieldId]); } + + public function deleteAllSummaryFields() + { + return $this->deleteSummaryFields( + collect($this->getSummaryFields()->fields) + ->pluck('id') + ->toArray() + ); + } }