in reply to Filling spreadsheet columns with data from database

Myself, I would avoid the templating, and use a database table keyed on client-id.

Load data from the exported spreadsheet. Merge with existing records or create new records as needed.

Update as needed from existing database. Then export the new csv file.
  • Comment on Re: Filling spreadsheet columns with data from database

Replies are listed 'Best First'.
Re^2: Filling spreadsheet columns with data from database
by perlancar (Hermit) on Apr 23, 2019 at 12:59 UTC
    The actual SQL could be more complex, e.g. several joins and subselects. And I'd like to be more general: there might be cases when the primary key is not specified in the sheet's columns.