1
1
import argparse
2
2
import traceback
3
+ import sys
3
4
4
5
from src import commits_parser
5
6
from src import contributors_parser
10
11
from src import pull_requests_parser
11
12
from src import wikipars
12
13
from src import workflow_runs_parser
13
- from src .utils import parse_time
14
+ from src .utils import parse_time , validate_and_normalize_cell
14
15
15
16
16
17
def parse_args ():
@@ -35,6 +36,13 @@ def parse_args():
35
36
help = "export table to google sheets" ,
36
37
action = "store_true" ,
37
38
)
39
+ parser .add_argument (
40
+ '--start_cell' ,
41
+ type = str ,
42
+ required = False ,
43
+ help = 'Starting cell for Google Sheets export (e.g., "A1", "B3")' ,
44
+ default = None
45
+ )
38
46
39
47
parser .add_argument (
40
48
'--base_url' ,
@@ -162,14 +170,26 @@ def run(args, binded_repos, repos_for_wiki=None):
162
170
if args .wikis :
163
171
wikipars .wikiparser (repos_for_wiki , args .download_repos , args .out )
164
172
if args .export_google_sheets :
165
- export_sheets .write_data_to_table (
166
- args .out , args .google_token , args .table_id , args .sheet_id
167
- )
173
+ if args .start_cell :
174
+ export_sheets .write_data_to_table (
175
+ args .out , args .google_token , args .table_id , args .sheet_id , args .start_cell
176
+ )
177
+ else :
178
+ export_sheets .write_data_to_table (
179
+ args .out , args .google_token , args .table_id , args .sheet_id
180
+ )
168
181
169
182
170
183
def main ():
171
184
args = parse_args ()
172
185
186
+ if args .start_cell is not None :
187
+ try :
188
+ args .start_cell = validate_and_normalize_cell (args .start_cell )
189
+ except ValueError as e :
190
+ print (f"Error in start_cell argument: { e } " )
191
+ sys .exit (1 )
192
+
173
193
if args .token :
174
194
tokens = [args .token ]
175
195
else :
0 commit comments