11import argparse
22import traceback
3+ import sys
34
45from src import commits_parser
56from src import contributors_parser
1011from src import pull_requests_parser
1112from src import wikipars
1213from src import workflow_runs_parser
13- from src .utils import parse_time
14+ from src .utils import parse_time , validate_and_normalize_cell
1415
1516
1617def parse_args ():
@@ -35,6 +36,13 @@ def parse_args():
3536 help = "export table to google sheets" ,
3637 action = "store_true" ,
3738 )
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+ )
3846
3947 parser .add_argument (
4048 '--base_url' ,
@@ -162,14 +170,26 @@ def run(args, binded_repos, repos_for_wiki=None):
162170 if args .wikis :
163171 wikipars .wikiparser (repos_for_wiki , args .download_repos , args .out )
164172 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+ )
168181
169182
170183def main ():
171184 args = parse_args ()
172185
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+
173193 if args .token :
174194 tokens = [args .token ]
175195 else :
0 commit comments