Skip to content

Commit

Permalink
adding addColumn(s) and deleteAllSummaryFields
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeldchin committed Oct 26, 2021
1 parent 23c7efd commit 348dc42
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/Resources/Sheet.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down Expand Up @@ -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()
);
}
}

0 comments on commit 348dc42

Please sign in to comment.