@@ -41,7 +41,7 @@ def parse_args():
41
41
type = str ,
42
42
required = False ,
43
43
help = 'Starting cell for Google Sheets export (e.g., "A1", "B3")' ,
44
- default = None
44
+ default = "A1"
45
45
)
46
46
47
47
parser .add_argument (
@@ -117,11 +117,17 @@ def parse_args():
117
117
help = 'Specify Google sheet document id (can find in url)' ,
118
118
)
119
119
parser .add_argument (
120
- '--sheet_id ' ,
120
+ '--sheet_name ' ,
121
121
type = str ,
122
122
required = False ,
123
123
help = 'Specify title for a sheet in a document in which data will be printed' ,
124
124
)
125
+ parser .add_argument (
126
+ "--clear_sheet" ,
127
+ action = "store_true" ,
128
+ required = False ,
129
+ help = "Specify to clear sheet content before printing" ,
130
+ )
125
131
args = parser .parse_args ()
126
132
127
133
if args .export_google_sheets :
@@ -130,7 +136,7 @@ def parse_args():
130
136
action .required = True
131
137
if action .dest == 'table_id' :
132
138
action .required = True
133
- if action .dest == 'sheet_id ' :
139
+ if action .dest == 'sheet_name ' :
134
140
action .required = True
135
141
return parser .parse_args ()
136
142
@@ -170,25 +176,24 @@ def run(args, binded_repos, repos_for_wiki=None):
170
176
if args .wikis :
171
177
wikipars .wikiparser (repos_for_wiki , args .download_repos , args .out )
172
178
if args .export_google_sheets :
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
- )
179
+ export_sheets . write_data_to_table (
180
+ csv_path = args . out ,
181
+ google_token = args .google_token ,
182
+ table_id = args . table_id ,
183
+ sheet_name = args . sheet_name ,
184
+ start_cell = args . start_cell ,
185
+ clear_content = args .clear_sheet ,
186
+ )
181
187
182
188
183
189
def main ():
184
190
args = parse_args ()
185
191
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
+ try :
193
+ args .start_cell = validate_and_normalize_cell (args .start_cell )
194
+ except ValueError as e :
195
+ print (f"Error in start_cell argument: { e } " )
196
+ sys .exit (1 )
192
197
193
198
if args .token :
194
199
tokens = [args .token ]
0 commit comments