How to write a gel script to approve the Timesheet which are submitted
There is a process available out-of-the-box called "Conditional Automatic Approval". You could review this process and tweak it to meet your needs.
I have seen conflicting information on the message boards about whether it is possible to approve submitted timesheets via XOG, but if you're going to do it with a GEL script it would probably have to use XOG (if it works). You would NOT want to use a SQL update in a GEL script to do this.
You can load (pre) approved timesheets via XOG.
Regarding the SQL update, it is your choice but as of now (14.4), there are no downstream actions when a timesheet goes from Submitted to Approved. Still, the safest is to use a process to set the status to 'Approved'.
You can XOG update the timesheets. I wrote a XOG process to import timesheets, you can change the XOG on my script to "approved" and set the approver field. Here's a process I wrote to import timesheets from an external system and write them as Submitted into Clarity. You can alter this to read the timesheets that are Submitted and write them as Approved.
Retrieving data ...