If the number of data in the Python spreadsheet insert_row is flexible, we ask you to insert.

Asked 2 weeks ago, Updated 2 weeks ago, 2 views

Hi, everyone. I have a question when inserting Python spreadsheet data.

test = "FSDF","FDSFDS","FDSFDSFDS","FDSAFSD","ASDF" worksheet.insert_row (["Date", TEST", 4) max_rows = max_rows + 1 print("You have completed recording to the last row on the spreadsheet.")

If you put it in a variable called test and run it, as shown above,

raise APIError(response) gspread.exceptions.APIError: {'code': 400, 'message': 'Invalid values[3][1]: list_value {\n values {\n string_value: "FSDF"\n }\n values {\n string_value: "FDSFDS"\n }\n values {\n string_value: "FDSFDSFDS"\n }\n values {\n string_value: "FDSAFSD"\n }\n values {\n string_value: "ASDF"\n }\n}\n', 'status': 'INVALID_ARGUMENT'} PS H:\python\py_code>

This error occurs.

That's why worksheet.insert_row (["Date", "FSDF", "FDSFDS", "FDSFDSFDS", "FDSAFSD", "ASDF", 4)

This is a normal input.

What I want to do is that there are times when there are 10 rows of insert data and times when there is 1 row I'm trying to insert_row by putting a data form in a separate variable, but it doesn't work.

Please give me an answer.


2022-09-20 15:13

1 Answers

It worked out somehow.

test = ["FSDF","FDSFDS","FDSFDSFDS","FDSAFSD","ASDF"]
worksheet.insert_row(test, 4)

It's working like this way.


2022-09-20 15:13

If you have any answers or tips


© 2022 pinfo. All rights reserved.