Skip to content

Commit 8908cce

Browse files
rename sheet_id arg to sheet_name (to match content)
1 parent ea982dc commit 8908cce

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

main.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def parse_args():
117117
help='Specify Google sheet document id (can find in url)',
118118
)
119119
parser.add_argument(
120-
'--sheet_id',
120+
'--sheet_name',
121121
type=str,
122122
required=False,
123123
help='Specify title for a sheet in a document in which data will be printed',
@@ -130,7 +130,7 @@ def parse_args():
130130
action.required = True
131131
if action.dest == 'table_id':
132132
action.required = True
133-
if action.dest == 'sheet_id':
133+
if action.dest == 'sheet_name':
134134
action.required = True
135135
return parser.parse_args()
136136

@@ -172,11 +172,11 @@ def run(args, binded_repos, repos_for_wiki=None):
172172
if args.export_google_sheets:
173173
if args.start_cell:
174174
export_sheets.write_data_to_table(
175-
args.out, args.google_token, args.table_id, args.sheet_id, args.start_cell
175+
args.out, args.google_token, args.table_id, args.sheet_name, args.start_cell
176176
)
177177
else:
178178
export_sheets.write_data_to_table(
179-
args.out, args.google_token, args.table_id, args.sheet_id
179+
args.out, args.google_token, args.table_id, args.sheet_name
180180
)
181181

182182

src/export_sheets.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@
44
INT_MASS = [{"one": 1, "two": 2, "what?": 3}]
55

66

7-
def write_data_to_table(csv_path, google_token, table_id, sheet_id, start_cell="A1"):
8-
if google_token and sheet_id and table_id:
7+
def write_data_to_table(csv_path, google_token, table_id, sheet_name, start_cell="A1"):
8+
if google_token and sheet_name and table_id:
99
gc = pygsheets.authorize(service_file=google_token)
1010
sh = gc.open_by_key(table_id)
1111

1212
try:
13-
sh.worksheets('title', sheet_id)
13+
sh.worksheets('title', sheet_name)
1414
except Exception:
15-
sh.add_worksheet(sheet_id)
15+
sh.add_worksheet(sheet_name)
1616

17-
wk_content = sh.worksheet_by_title(sheet_id)
17+
wk_content = sh.worksheet_by_title(sheet_name)
1818

1919
if csv_path:
2020
df = pd.read_csv(csv_path, delimiter=',', encoding='utf-8')

0 commit comments

Comments
 (0)