Pass (CurrentSpreadsheet) from AppSheet app to Script

If I were able to pass the Sheet the app is working with, as a parameter to a script, it would open the doors to a lot of helpful scripts.

  • Granted - it opens the doors to a lot of problems if you're not careful too
    • But if you're calling a script in your app; chances are you're aware of what that script is doing (you did authorize it) - so I don't see this as an issue.

---------------------------------------------------------------------------------------------------------------

Off the top of my head:

  • Empty sheet of rows (reset sheet)
  • Remove blank rows
  • ADD a row
  • Update a row
  • etc.

---------------------------------------------------------------------------------------------------------------

As always, thanks for considering! 3X_d_5_d51363a862e7ab883241c312ac5d7f271579cdd3.gif

Status Open
4 4 506
4 Comments
Joseph_Seddik
Gold 4
Gold 4

@nico please see this. Thank you!

nico
Staff

Thanks for the suggestion. I do see why this would be helpful, in addition being able to specify the exact Sheet you have is often useful. Something like a special key on a table `[MySheetTable].[_spreadsheetid]` could be useful.

Since I don't think this will be high on our priority list soon since you can manually copy-paste the spreadsheet id as an argument as a decent workaround. I understand that can get ugly and error prone with lots of spreadsheets though.

There are ways you can write in code to search for the right spreadsheet using DriveApp functions and passing in the app name and table name, but that's fairly code-heavy and will be slower.

 

Joseph_Seddik
Gold 4
Gold 4

@nico Are there performance issues known with the DriveApp methods? or it "will be slower" potentially due to other factors like the number of files/folders? or other considerations?

Thank you!

Marc_Dillon
Platinum 1
Platinum 1

As a workaround, running your script from an onChange() event will easily get you on the current sheet. Of course you lose any benefit of calling it directly from the app that way.