Google-sheets – Publish last 5 entries from a Google Form

google sheetsgoogle-formsgoogle-sheets-query

We currently create and html table to list our last 5 Webinars. This is done manually. We are adding external contractors into the mix and would like to give them the ability to enter basic webinar information without accessing our site as admins.

We think the best approach is to allow them to enter this basic information in a Google form (date, title, link to webinar). We would then push results to a Google spreadsheet which is then embedded in an iframe on our site.

Seems simple enough, except we have two problems.

Problem One, when we push the form results to a spreadsheet, the spreadsheet displays all entries in order from oldest to newest. We'd like to limit it to the latest 5 entries and sort from latest to oldest. The sort function is disabled and the filter function only works once. (When a new entry is added, it's added to the bottom of the sheet.)

Problem two, we'd like to be able to add some html to the sheet that we embed. For example, we need to add some css classes to the video links in order to get the videos to display properly in a player.

Perhaps this is solved through a script? Any other ideas?

Best Answer

I'm considering Problem two as off topic here but for Problem One please try something like:

=query(importrange("https://docs.google.com/spreadsheets/d/$$$$","Applicant Form Response!A:H"),"Select * order by Col1 desc limit 5")  

where $$$$ is the rest of the URL for your Responses sheet.