Issue
I am using python to get some data from database to csv and from csv to google sheet (sheet1). When I write data from CSV to google sheet, it add a single quote in beginning of all values which changing integer, date to string. In CSV values doesn't have any single in beginning.
with open(csv_file_path, 'r') as csv_file:
csv_reader = csv.reader(csv_file)
next(csv_reader) # Skip the header row
data = list(csv_reader)
# Get existing records from the Google Sheet
worksheet.append_rows(data)
Values I expect
141872 2000 11/30/2023 10:11
Values written to Google sheet
'141872 '2000 '11/30/2023 10:11
Is there anyway to avoid adding single quote, want to write it as it is in CSV
Solution
In your script, how about modifying as follows?
From:
worksheet.append_rows(data)
To:
worksheet.append_rows(data, value_input_option="USER_ENTERED")
Reference:
Answered By - Tanaike
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.