Skip to content

Commit fa3f7fe

Browse files
authored
Fix: google sheets ranges with hyphens are not recognized (#655)
google sheets ranges with hyphens recognized
1 parent 191e86c commit fa3f7fe

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

sources/google_sheets/helpers/data_processing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
TIMESTAMP_CONST = -2209161600.0
2020
# compiled regex to extract ranges
2121
RE_PARSE_RANGE = re.compile(
22-
r"^(?:(?P<sheet>[\'\w\s]+)!)?(?P<start_col>[A-Z]+)(?P<start_row>\d+):(?P<end_col>[A-Z]+)(?P<end_row>\d+)$"
22+
r"^(?:(?P<sheet>[\'\w\s\-]+)!)?(?P<start_col>[A-Z]+)(?P<start_row>\d+):(?P<end_col>[A-Z]+)(?P<end_row>\d+)$"
2323
)
2424

2525

tests/google_sheets/test_google_sheets_source.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import pytest
44
import dlt
5-
from datetime import date # noqa: I251
5+
from datetime import date # noqa: I251
66
from dlt.common.pipeline import LoadInfo
77
from sources.google_sheets import google_spreadsheet
88
from tests.utils import (
@@ -37,7 +37,7 @@
3737
"trailing_empty_cols_1",
3838
"trailing_empty_cols_2",
3939
"trailing_empty_cols_3",
40-
"trailing_empty_col_date",
40+
"trailing_empty_col-date",
4141
}
4242

4343
SKIPPED_RANGES = {
@@ -774,11 +774,11 @@ def test_trailing_empty_col_date(with_hints: bool) -> None:
774774
)
775775
data = google_spreadsheet(
776776
"1HhWHjqouQnnCIZAFa2rL6vT91YRN8aIhts22SUUR580",
777-
range_names=["trailing_empty_cols_1", "trailing_empty_col_date"],
777+
range_names=["trailing_empty_cols_1", "trailing_empty_col-date"],
778778
get_named_ranges=False,
779779
)
780780
if with_hints:
781-
data.trailing_empty_col_date.apply_hints(
781+
data.resources["trailing_empty_col-date"].apply_hints(
782782
columns={"Start Date": {"data_type": "date"}}
783783
)
784784
info = pipeline.run(data)

0 commit comments

Comments
 (0)