'How add lines in a text to an append request on API Google spreadsheet without destroy my quota
I'm not an expert programmer and I extract some data to a text file, and now I want to import it to a Google spreadsheet. I can do this and it works till quota limits. How can I add all the lines to a single request?
insert_data_option = 'OVERWRITE'
with open(r"juntos.txt", "r", encoding="utf8") as inputfile:
for line in inputfile:
string = line.rstrip(" \n")
value_range_body = {
"majorDimension": "ROWS",
"range": "A:B",
"values": [
[
string
]
]
}
request = service.spreadsheets().values().append(spreadsheetId=spreadsheet_id, range=range_, valueInputOption=value_input_option, insertDataOption=insert_data_option, body=value_range_body)
response = request.execute()
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
