python-google-sheets 1.0.0__tar.gz → 1.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (23) hide show
  1. {python_google_sheets-1.0.0 → python_google_sheets-1.1.0}/PKG-INFO +21 -4
  2. {python_google_sheets-1.0.0 → python_google_sheets-1.1.0}/README.md +20 -3
  3. {python_google_sheets-1.0.0 → python_google_sheets-1.1.0}/google_sheets/api_request.py +33 -0
  4. {python_google_sheets-1.0.0 → python_google_sheets-1.1.0}/google_sheets/spreadsheet_requests/__init__.py +1 -0
  5. {python_google_sheets-1.0.0 → python_google_sheets-1.1.0}/google_sheets/spreadsheet_requests/conditional_format_rule.py +1 -1
  6. {python_google_sheets-1.0.0 → python_google_sheets-1.1.0}/google_sheets/spreadsheet_requests/dimension.py +8 -0
  7. {python_google_sheets-1.0.0 → python_google_sheets-1.1.0}/pyproject.toml +1 -1
  8. {python_google_sheets-1.0.0 → python_google_sheets-1.1.0}/python_google_sheets.egg-info/PKG-INFO +21 -4
  9. {python_google_sheets-1.0.0 → python_google_sheets-1.1.0}/LICENSE +0 -0
  10. {python_google_sheets-1.0.0 → python_google_sheets-1.1.0}/google_sheets/__init__.py +0 -0
  11. {python_google_sheets-1.0.0 → python_google_sheets-1.1.0}/google_sheets/google_sheets.py +0 -0
  12. {python_google_sheets-1.0.0 → python_google_sheets-1.1.0}/google_sheets/spreadsheet_requests/general_models.py +0 -0
  13. {python_google_sheets-1.0.0 → python_google_sheets-1.1.0}/google_sheets/spreadsheet_requests/merge_cells.py +0 -0
  14. {python_google_sheets-1.0.0 → python_google_sheets-1.1.0}/google_sheets/spreadsheet_requests/spreadsheet.py +0 -0
  15. {python_google_sheets-1.0.0 → python_google_sheets-1.1.0}/google_sheets/spreadsheet_requests/update_cells.py +0 -0
  16. {python_google_sheets-1.0.0 → python_google_sheets-1.1.0}/google_sheets/spreadsheet_requests/update_sheet_properties.py +0 -0
  17. {python_google_sheets-1.0.0 → python_google_sheets-1.1.0}/google_sheets/styles.py +0 -0
  18. {python_google_sheets-1.0.0 → python_google_sheets-1.1.0}/google_sheets/utils.py +0 -0
  19. {python_google_sheets-1.0.0 → python_google_sheets-1.1.0}/python_google_sheets.egg-info/SOURCES.txt +0 -0
  20. {python_google_sheets-1.0.0 → python_google_sheets-1.1.0}/python_google_sheets.egg-info/dependency_links.txt +0 -0
  21. {python_google_sheets-1.0.0 → python_google_sheets-1.1.0}/python_google_sheets.egg-info/requires.txt +0 -0
  22. {python_google_sheets-1.0.0 → python_google_sheets-1.1.0}/python_google_sheets.egg-info/top_level.txt +0 -0
  23. {python_google_sheets-1.0.0 → python_google_sheets-1.1.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-google-sheets
3
- Version: 1.0.0
3
+ Version: 1.1.0
4
4
  Summary: A lightweight and efficient Python wrapper for the Google Sheets API v4
5
5
  Author-email: Timofey Egorov <timegorr@gmail.com>
6
6
  License-Expression: MIT
@@ -151,6 +151,7 @@ req = ApiRequest.update_cells(
151
151
  )
152
152
  ```
153
153
 
154
+ ---
154
155
  ### Conditional formatting
155
156
 
156
157
  ### `add_boolean_format_rule(*, sheet_id: int, ranges: list[str], condition_type: ConditionType, condition_values: list[ConditionValue] = None, cell_format: CellFormat) -> dict`
@@ -311,6 +312,7 @@ req = ApiRequest.add_sheet(
311
312
  )
312
313
  ```
313
314
 
315
+ ---
314
316
  ### Merge and freeze
315
317
 
316
318
  ### `merge_cells(sheet_id: int, range_: str, merge_type: MergeType = MergeType.MERGE_ALL) -> dict`
@@ -334,24 +336,39 @@ Freeze top rows and/or left columns.
334
336
  req = ApiRequest.freeze(sheet_id=0, rows=1, columns=1)
335
337
  ```
336
338
 
339
+ ---
337
340
  ### Rows and columns
338
341
 
339
342
  ### `insert_rows(sheet_id: int, start_index: int, end_index: int = None, inherit_from_before: bool = True) -> dict`
340
- Insert one or more rows (zero-based indexes).
343
+ Insert one or more rows (Indexes are zero-based and inclusive [start_index, end_index]).
341
344
 
342
345
  ```python
343
346
  req = ApiRequest.insert_rows(sheet_id=0, start_index=5, end_index=9)
344
347
  ```
345
348
 
346
349
  ### `insert_columns(sheet_id: int, start_index: int, end_index: int = None, inherit_from_before: bool = True) -> dict`
347
- Insert columns (zero-based indexes).
350
+ Insert columns (Indexes are zero-based and inclusive [start_index, end_index]).
348
351
 
349
352
  ```python
350
353
  req = ApiRequest.insert_columns(sheet_id=0, start_index=2, end_index=3)
351
354
  ```
352
355
 
356
+ ### `delete_rows(sheet_id: int, start_index: int, end_index: int = None) -> dict`
357
+ Delete one or more rows (Indexes are zero-based and inclusive [start_index, end_index]).
358
+
359
+ ```python
360
+ req = ApiRequest.delete_rows(sheet_id=0, start_index=5, end_index=9)
361
+ ```
362
+
363
+ ### `delete_columns(sheet_id: int, start_index: int, end_index: int = None) -> dict`
364
+ Delete columns (Indexes are zero-based and inclusive [start_index, end_index]).
365
+
366
+ ```python
367
+ req = ApiRequest.delete_columns(sheet_id=0, start_index=2, end_index=3)
368
+ ```
369
+
353
370
  ### `clear_columns(sheet_id: int, rows_count: int, start_index: int, end_index: int = None) -> dict`
354
- Clear values and formatting in one or more columns.
371
+ Clear values and formatting in one or more columns (Indexes are zero-based and inclusive [start_index, end_index]).
355
372
 
356
373
  ```python
357
374
  req = ApiRequest.clear_columns(sheet_id=0, rows_count=500, start_index=4, end_index=5)
@@ -135,6 +135,7 @@ req = ApiRequest.update_cells(
135
135
  )
136
136
  ```
137
137
 
138
+ ---
138
139
  ### Conditional formatting
139
140
 
140
141
  ### `add_boolean_format_rule(*, sheet_id: int, ranges: list[str], condition_type: ConditionType, condition_values: list[ConditionValue] = None, cell_format: CellFormat) -> dict`
@@ -295,6 +296,7 @@ req = ApiRequest.add_sheet(
295
296
  )
296
297
  ```
297
298
 
299
+ ---
298
300
  ### Merge and freeze
299
301
 
300
302
  ### `merge_cells(sheet_id: int, range_: str, merge_type: MergeType = MergeType.MERGE_ALL) -> dict`
@@ -318,24 +320,39 @@ Freeze top rows and/or left columns.
318
320
  req = ApiRequest.freeze(sheet_id=0, rows=1, columns=1)
319
321
  ```
320
322
 
323
+ ---
321
324
  ### Rows and columns
322
325
 
323
326
  ### `insert_rows(sheet_id: int, start_index: int, end_index: int = None, inherit_from_before: bool = True) -> dict`
324
- Insert one or more rows (zero-based indexes).
327
+ Insert one or more rows (Indexes are zero-based and inclusive [start_index, end_index]).
325
328
 
326
329
  ```python
327
330
  req = ApiRequest.insert_rows(sheet_id=0, start_index=5, end_index=9)
328
331
  ```
329
332
 
330
333
  ### `insert_columns(sheet_id: int, start_index: int, end_index: int = None, inherit_from_before: bool = True) -> dict`
331
- Insert columns (zero-based indexes).
334
+ Insert columns (Indexes are zero-based and inclusive [start_index, end_index]).
332
335
 
333
336
  ```python
334
337
  req = ApiRequest.insert_columns(sheet_id=0, start_index=2, end_index=3)
335
338
  ```
336
339
 
340
+ ### `delete_rows(sheet_id: int, start_index: int, end_index: int = None) -> dict`
341
+ Delete one or more rows (Indexes are zero-based and inclusive [start_index, end_index]).
342
+
343
+ ```python
344
+ req = ApiRequest.delete_rows(sheet_id=0, start_index=5, end_index=9)
345
+ ```
346
+
347
+ ### `delete_columns(sheet_id: int, start_index: int, end_index: int = None) -> dict`
348
+ Delete columns (Indexes are zero-based and inclusive [start_index, end_index]).
349
+
350
+ ```python
351
+ req = ApiRequest.delete_columns(sheet_id=0, start_index=2, end_index=3)
352
+ ```
353
+
337
354
  ### `clear_columns(sheet_id: int, rows_count: int, start_index: int, end_index: int = None) -> dict`
338
- Clear values and formatting in one or more columns.
355
+ Clear values and formatting in one or more columns (Indexes are zero-based and inclusive [start_index, end_index]).
339
356
 
340
357
  ```python
341
358
  req = ApiRequest.clear_columns(sheet_id=0, rows_count=500, start_index=4, end_index=5)
@@ -29,6 +29,7 @@ from .spreadsheet_requests import (
29
29
 
30
30
  # dimension
31
31
  InsertDimension,
32
+ DeleteDimension,
32
33
  UpdateDimensionProperties,
33
34
  AddDimensionGroup,
34
35
  DeleteDimensionGroup,
@@ -409,6 +410,38 @@ class ApiRequest:
409
410
  inherit_from_before=inherit_from_before
410
411
  ).dict()
411
412
 
413
+ @staticmethod
414
+ def delete_rows(sheet_id: int, start_index: int, end_index: int = None):
415
+ """
416
+ Indexes are zero-based and inclusive [start_index, end_index]. If end_index is not specified, then a single
417
+ row at start_index will be deleted.
418
+ """
419
+ end_index = end_index or start_index
420
+ return DeleteDimension(
421
+ range=DimensionRange(
422
+ sheet_id=sheet_id,
423
+ dimension=Dimension.ROWS,
424
+ start_index=start_index,
425
+ end_index=end_index + 1
426
+ )
427
+ ).dict()
428
+
429
+ @staticmethod
430
+ def delete_columns(sheet_id: int, start_index: int, end_index: int = None):
431
+ """
432
+ Indexes are zero-based and inclusive [start_index, end_index]. If end_index is not specified, then a single
433
+ column at start_index will be deleted.
434
+ """
435
+ end_index = end_index or start_index
436
+ return DeleteDimension(
437
+ range=DimensionRange(
438
+ sheet_id=sheet_id,
439
+ dimension=Dimension.COLUMNS,
440
+ start_index=start_index,
441
+ end_index=end_index + 1
442
+ )
443
+ ).dict()
444
+
412
445
  @staticmethod
413
446
  def clear_columns(sheet_id: int, rows_count: int, start_index: int, end_index: int = None) -> dict:
414
447
  """
@@ -24,6 +24,7 @@ from .merge_cells import (
24
24
  )
25
25
  from .dimension import (
26
26
  InsertDimension,
27
+ DeleteDimension,
27
28
  UpdateDimensionProperties,
28
29
  AddDimensionGroup,
29
30
  DeleteDimensionGroup,
@@ -100,7 +100,7 @@ class ConditionType(StrEnum):
100
100
 
101
101
  class BooleanCondition(BaseModel):
102
102
  type: ConditionType
103
- values: list[ConditionValue]
103
+ values: list[ConditionValue] = Field(default_factory=list)
104
104
 
105
105
 
106
106
  class BooleanRule(BaseModel):
@@ -51,6 +51,14 @@ class InsertDimension(BaseModel):
51
51
  return {class_name: json.loads(super().json(*args, **kwargs, by_alias=True, exclude_none=True))}
52
52
 
53
53
 
54
+ class DeleteDimension(BaseModel):
55
+ range: DimensionRange
56
+
57
+ def dict(self, *args, **kwargs):
58
+ class_name = self.__class__.__name__[0].lower() + self.__class__.__name__[1:]
59
+ return {class_name: json.loads(super().json(*args, **kwargs, by_alias=True, exclude_none=True))}
60
+
61
+
54
62
  class UpdateDimensionProperties(BaseModel):
55
63
  range: DimensionRange
56
64
  properties: DimensionProperties
@@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
6
6
  name = "python-google-sheets"
7
7
  description = "A lightweight and efficient Python wrapper for the Google Sheets API v4"
8
8
  authors = [{ name = "Timofey Egorov", email = "timegorr@gmail.com" }]
9
- version = "1.0.0"
9
+ version = "1.1.0"
10
10
  readme = "README.md"
11
11
  requires-python = ">=3.11"
12
12
  classifiers = [
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-google-sheets
3
- Version: 1.0.0
3
+ Version: 1.1.0
4
4
  Summary: A lightweight and efficient Python wrapper for the Google Sheets API v4
5
5
  Author-email: Timofey Egorov <timegorr@gmail.com>
6
6
  License-Expression: MIT
@@ -151,6 +151,7 @@ req = ApiRequest.update_cells(
151
151
  )
152
152
  ```
153
153
 
154
+ ---
154
155
  ### Conditional formatting
155
156
 
156
157
  ### `add_boolean_format_rule(*, sheet_id: int, ranges: list[str], condition_type: ConditionType, condition_values: list[ConditionValue] = None, cell_format: CellFormat) -> dict`
@@ -311,6 +312,7 @@ req = ApiRequest.add_sheet(
311
312
  )
312
313
  ```
313
314
 
315
+ ---
314
316
  ### Merge and freeze
315
317
 
316
318
  ### `merge_cells(sheet_id: int, range_: str, merge_type: MergeType = MergeType.MERGE_ALL) -> dict`
@@ -334,24 +336,39 @@ Freeze top rows and/or left columns.
334
336
  req = ApiRequest.freeze(sheet_id=0, rows=1, columns=1)
335
337
  ```
336
338
 
339
+ ---
337
340
  ### Rows and columns
338
341
 
339
342
  ### `insert_rows(sheet_id: int, start_index: int, end_index: int = None, inherit_from_before: bool = True) -> dict`
340
- Insert one or more rows (zero-based indexes).
343
+ Insert one or more rows (Indexes are zero-based and inclusive [start_index, end_index]).
341
344
 
342
345
  ```python
343
346
  req = ApiRequest.insert_rows(sheet_id=0, start_index=5, end_index=9)
344
347
  ```
345
348
 
346
349
  ### `insert_columns(sheet_id: int, start_index: int, end_index: int = None, inherit_from_before: bool = True) -> dict`
347
- Insert columns (zero-based indexes).
350
+ Insert columns (Indexes are zero-based and inclusive [start_index, end_index]).
348
351
 
349
352
  ```python
350
353
  req = ApiRequest.insert_columns(sheet_id=0, start_index=2, end_index=3)
351
354
  ```
352
355
 
356
+ ### `delete_rows(sheet_id: int, start_index: int, end_index: int = None) -> dict`
357
+ Delete one or more rows (Indexes are zero-based and inclusive [start_index, end_index]).
358
+
359
+ ```python
360
+ req = ApiRequest.delete_rows(sheet_id=0, start_index=5, end_index=9)
361
+ ```
362
+
363
+ ### `delete_columns(sheet_id: int, start_index: int, end_index: int = None) -> dict`
364
+ Delete columns (Indexes are zero-based and inclusive [start_index, end_index]).
365
+
366
+ ```python
367
+ req = ApiRequest.delete_columns(sheet_id=0, start_index=2, end_index=3)
368
+ ```
369
+
353
370
  ### `clear_columns(sheet_id: int, rows_count: int, start_index: int, end_index: int = None) -> dict`
354
- Clear values and formatting in one or more columns.
371
+ Clear values and formatting in one or more columns (Indexes are zero-based and inclusive [start_index, end_index]).
355
372
 
356
373
  ```python
357
374
  req = ApiRequest.clear_columns(sheet_id=0, rows_count=500, start_index=4, end_index=5)