Adding a custom button (and related actions) that will always show on a table based on a slice

I am trying to add a button to “Send Order” to an “Order” UI that is displaying a slice of data from an Google Sheet “Inventory” table.

The underlying “Inventory” Google sheet includes 3 relevant columns, “Current Stock Level”, “Minimum Stock Level” and “Order Amount”. The “Order Amount” column is automatically calculated by a formula in the google sheet that calculates the difference between the “Minimum Stock Level” and the “Current Stock Level”.

There are multiple rows in the Inventory table, but only those with a “Current Stock Level” lower than the “Minimum Stock Level” will need restocking. The slice limits the table to only those items that have a positive order amount (i.e. the “Current Stock Level” is lower than the “Minimum Stock Level”).

This table and the slice are working perfectly - it is only showing those rows that need to be restocked, along with the calculated “Order Amount”.

I now want to add a button that will appear on the Table view whenever at least one row needs to be restocked (i.e. the slice includes at least one data row).

When the button is clicked, I want it to create a CSV and PDF file containing all of the rows in the table (limited by the slice). These files to be formatted based on a template. I then want an email to be created and sent to the user’s email address, with the CSV file and the PDF attached. Ideally, I would like the user to be able to choose who to send the email to (from a list of users in a user’s table).

I don’t want the user to have to click a row on the table in order to have the button appear. I want the button to always be visible, as long as there is at least one row visible in the slice.

Is there any way to achieve what I want - I’m really struggling to see how to

  1. Create a button with a custom description and icon that will appear on a table view of a slice
  2. Make the button appear without the user having to click a row etc.
  3. Make the button disappear if there are zero rows visible in the slice.
  4. Have the button create a CSV file containing all the columns and rows in the slice, in a pre-defined format.
  5. Have the button create a PDF file containing all the columns and rows in the slice, in a pre-defined format.
  6. Allow the user to select who to send the email to from a list of users in the user table.
  7. Create an email to the chosen user, attach the csv and pdf to it and send it.
  8. Confirm to the user that the process has completed successfully.

I can kind of see how to do 4-8 from some of the online examples, but I’m stuck on steps 1-3, so any help would be greatly appreciated.

Thanks in advance!

0 3 7,746
3 REPLIES 3
Top Labels in this Space