You may try to adapt a recipe I've already provided in another answer to programmatically adding custom projections
my_new_projection = QgsCoordinateReferenceSystem("PROJ:+proj=ortho +lat_0=51.470129 +lon_0=-0.452751 +x_0=0 +y_0=0 +a=1188300 +b=1188300 +units=m +no_defs")
my_new_projection.saveAsUserCrs('my_new_projection name') # Save the definition so can be reusable later
QgsProject.instance().setCrs(my_new_projection)
What is missing in above answer is the fact, you should loop on CSV/txt file content using Python (not geo-related, pure programing). For this intent, look at https://realpython.com/python-csv/#parsing-csv-files-with-pythons-built-in-csv-library
The other solution can be to manipulate SQlite srs.db
, the internal QGIS database for managing crs/srs. You can find it path on your computer by running in Python QGIS console this code QgsApplication.srsDatabaseFilePath()
.
For projections, you should look at QgsCoordinateReferenceSystem
class API doc