Get the lastest date history from spreadsheet data

I want to make an application to show the lastest date from maintenance history in spreadsheet. here is my spreadsheet:

if i entered the serial number, then I can display data on the last date of the tool's maintenance history.
example, i entered a serial number: 04018438LF. After I press the button, it will display the data from 23/08//2024(the lastest update data)
here is my code:


i've tried it before, then this error appears:

image

You can use gviz query to do all of this in one hit.

https://docs.google.com/spreadsheets/d/<SHEETID>/tq?tqx=out:csv&headers=0&gid=<GID>&tq=SELECT * WHERE B contains '<SERIAL>' ORDER BY A DESC LIMIT 1

Here colA is the timestamp, and colB is the serial

note the use of &headers=0 to prevent the header row being returned

1 Like

Thank you so much for your help, i have solved it with this code

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.