Google Sheets Append New Row(s) Bug?

In our app, when we "Append Data to a Spreadsheet" and give it an object with each matching column it appends them to the next blank row - but it starts at the column AFTER.

Example:

Sheet has data in columns A10 to C10

If we submit data we want in A11, B11, C11, they will get added on D11, E11, F11 for some reason.

Is this a known issue?

Hi @thisbeali Thanks for reaching out!

Append adds to the next row in the sheet, but the update and bulk update query types will modify existing rows if there is a match. It sounds like you may need to switch your query to an update action type:

But we do want to append new rows to the data sheet, not update existing rows.

It is doing the correct actions and adding new rows with the correct data, but for some reason it is offsetting the columns despite the rows it's adding being new and empty.

I.e. It adds the correct data to the correct new rows, but offsets the columns by the existing columns even (which leaves a big gap).

Ah I see :thinking: Can you share screenshots? I'm not seeing the same issue yet

Hi @thisbeali, I also just encountered this bug. It seems to happen whenever one of your columns doesn't have a name. In our case, we can probably work around it by giving all intermediate columns a heading/name.

1 Like

Thank you for chiming in!

(To clarify, this is not the only case in which it happens, but I couldn't nail down a root cause for other cases.)

1 Like

Will tentatively leave as a solution, but let us know if this doesn't resolve - @thisbeali

OK so I ran into this again. This definitely looks like a Retool shortcoming to me now.

The root cause is that Google Sheets has a pretty complex logic for deciding what "the table" is in a given Sheet. And there might be several "tables" detected (by Google) within a Sheet.

Details are here.

For this reason, Google specifies that when appending, it's important to specify the correct range. However, Retool automatically fills in an update range of A1:ZZ1 and there is no way to change this. So this results in the wrong "table" being detected, and thus data being appended with a shift applied.

See also e.g. this bug report on a related toolkit. (many other bug reports on the same project, it's a well known gotcha with Google Sheets append)

One fix would be for Retool to support setting the range manually, overwriting the A1:ZZ1 default.

3 Likes

Got it! I'm filing a feature request for that. In the meantime, if you use the sheets api in our rest api integration, you should be able to set that parameter

It looks like I am running into a similar issue. Tried simplifying the columns and tried naming all the column headers but the shift bug continues.

1 Like