SQL Logic Replacement with Google Script
Project detail
I have a t-SQL query that I run that I would like to replace with a Google Script.
I have a Google Sheet that has a column of data in it. I would like a script that parses this data, and applies some basic logic (14 conditions case statement), and returns the data back to Google Sheets.
I would also like it to ask the user for a starting number and the results back will start with that number.
Source Column
NAME1*RED*5
NAME2*BLUE*17
NAME3*ORANGE*61
NAME4*BLUE*2
Logic Example
If Color = Blue AND ItemCount > 5 Then Aisle7
If Color = Orange AND ItemCount > 50 Then Aisle16
Else Look up Aisle in Table
Table Example
Blue = Aisle5
Red = Aisle2
Orange = Aisle3
Output
NAME1 Aisle2
NAME2 Aisle7
NAME3 Aisle16
NAME4 Aisle
The t-sql doesn’t actually use any tables in the SQL database, it was just a convenient way to prototype the logic.