You can use GAMADV-XTD3 for example.
That will push your CSV to a Sheet (not the active sheet), and then you do all the magic there.
No need for Apps Script, as all you describe are things that can be done with formulas.
Then you use IMPORTRANGE to pull the data from your temporary/magic sheet into the active spreadsheet.
If you want the data to be formatted in som special way in your active spreadsheet then you can choose to do so either by formatting cells, or maybe use some apps script to do it dynamically (if necessary).