Skip to content

Commit 52d216e

Browse files
load dataframe as csv (write_data_to_table)
1 parent 83c52f1 commit 52d216e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

common_grade_export/src/utils/gspread.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import csv
22
import os
3+
from io import StringIO
34

45
import pandas as pd
56
import pygsheets
@@ -43,7 +44,13 @@ def write_data_to_table(
4344

4445
wk_content = sh.worksheet_by_title(sheet_name)
4546

46-
wk_content.set_dataframe(df_data, "A1", copy_head=True)
47+
# wk_content.set_dataframe(df_data, "A1", copy_head=True) # problem w/float dot
48+
stream = StringIO()
49+
df_data.to_csv(stream, sep=CSV_DELIMITER)
50+
reader = csv.reader(stream, delimiter=CSV_DELIMITER)
51+
for row in reader:
52+
print(row)
53+
wk_content.append(row)
4754

4855

4956
def add_csv_to_table_dis(

0 commit comments

Comments
 (0)