Skip to content

Commit 1cc8d76

Browse files
committed
add. support for batch update
1 parent d418cfe commit 1cc8d76

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

src/SheetDB.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,22 @@ public function update($columnName, $value, array $data, $putMethod = false) {
135135
return false;
136136
}
137137

138+
/**
139+
* Update the batch of rows in the spreadsheet
140+
* @param array $data
141+
* @param bool $putMethod If it's true, make PUT request, otherwise PATCH
142+
* @return int|bool Count of rows updated or false
143+
*/
144+
public function batchUpdate(array $data, $putMethod = false) {
145+
$this->connection->resetQueryParams();
146+
$this->connection->setUrl($this->handlerUrl('/batch_update'));
147+
$response = $this->connection->makeRequest($putMethod === true ? 'put' : 'patch', $data);
148+
if ($response && isset($response->updated)){
149+
return $response->updated;
150+
}
151+
return false;
152+
}
153+
138154
/**
139155
* Delete a row(s) in spreadsheet
140156
* @param string $columnName

0 commit comments

Comments
 (0)