Home > other >  Preventing API edits from breaking arrayformula columns
Preventing API edits from breaking arrayformula columns

Time:11-12

I have a Google Sheet that I'm using as a database for a an app I am building in AppSmith. Really just an interface for people to work with the sheet in a controlled manner.

I'm using the Google Sheet because I'm familiar with layering formulas to make it work the way I want it to work. I have a number of columns that start with an ARRAYFORMULA that gives the name of the column in row 1, blank in blank rows that should be blank, and some programmed information in other rows.

This works great as long as I am working from the spreadsheet or reading/adding rows from the app.

However, when I try to edit the row from the app, the API update will take the "50" that it sees in the column and actually put "50" in the cell, breaking the arrayformula.

Is there any way to prevent API calls from actually editing that column? Or to automatically clear the cell and let the arrayformula expand again?


I found a temporary workaround to push "" for the column(s) I know are arrays, but it seems vulnerable to complications if I add other array columns later, or want to make another form in the app that also updates the sheet.

CodePudding user response:

As a "rule of thumb", avoid having formulas on sheets being used as "databases" (top row used for field names, 2nd row and below used for data). If you really need to use formulas in the spreadsheet instead of doing the calculations on the "APP", add them on a "mirror" sheet.

This is a common recommendation when using ARRAYFORMULAS to do calculations with data comming from Google Forms.

If you think that creating a "mirror" sheet might cause more problems than benefits, if your "APP" is able to limit the number of columns being edited, put the formulas to the right of the last column linked to the app.

Related

CodePudding user response:

I don't know how does that app works nor its APIs. Inside Sheets/App Scripts, I have a set of columns that when I add a new row it loops through that set and delete the contents of them.

Could you set something like that??

Another option not so ideal is to make a script inside your Sheet that triggers automatically in X amount of minutes and clears all the needed columns. Or maybe you can call it from AppSmith?? Or maybe try another kind of triggers

  • Related