Help creating a chart from command line

I want to be able to open Calc from a shell script, have it read data from a file and display a chart based on that data. Data ranges will be variable - meaning that the number of columns and number of rows may vary from one instance to the next. The X axis will be dates and the Y-axis numeric values, with a series of colored connecting lines based on the titles of the columns.

I can figure out how to build the scatter chart with fixed data and range size using data that I manually enter, but I do not know how to automatically import that data from a csv file (which will vary in the number of rows and columns), nor how to have Calc do this automatically and create the chart. (Possibly using a template?).

Is this even something that is doable?

I think something like ggplot2 for R may be more suitable for inclusion in shell scripts if that is a requirement.