Skip to content

Commit f69a061

Browse files
committed
Merge branch 'erikverheij-feature/update-worksheet'
2 parents 458faf1 + 578ed7c commit f69a061

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

src/Google/Spreadsheet/Worksheet.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,35 @@ public function getCsv()
163163
return ServiceRequestFactory::getInstance()->get($this->getExportCsvUrl());
164164
}
165165

166+
/*
167+
* Update worksheet
168+
*
169+
* @param string $title will not be updated if null or omitted.
170+
* @param int $colCount will not be updated if null or omitted.
171+
* @param int $rowCount will not be updated if null or omitted.
172+
*
173+
* @return void
174+
*/
175+
public function update($title = null, $colCount = null, $rowCount = null)
176+
{
177+
$title = $title ? $title : $this->getTitle();
178+
$colCount = $colCount ? $colCount : $this->getColCount();
179+
$rowCount = $rowCount ? $rowCount : $this->getRowCount();
180+
181+
$entry = sprintf('
182+
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:gs="http://schemas.google.com/spreadsheets/2006">
183+
<title type="text">%s</title>
184+
<gs:colCount>%s</gs:colCount>
185+
<gs:rowCount>%s</gs:rowCount>
186+
</entry>',
187+
$title,
188+
$colCount,
189+
$rowCount
190+
);
191+
192+
ServiceRequestFactory::getInstance()->put($this->getEditUrl(), $entry);
193+
}
194+
166195
/**
167196
* Delete this worksheet
168197
*

0 commit comments

Comments
 (0)