You could either make it a rake task or it it in a job that you should start manually from /sidekiq
You can either upload your csv from the UX and pass it with a setting value as suggested, or upload it into a topic and have your script get the most recent post/upload in the topic, or upload it to /var/discourse/shared/standalone/xxx.csv and the access it as /shared/xxx.csv in the script. Or maybe you should be doing the whole thing with the API rather than uploading a csv file.
You don’t describe what you’re trying to do, just your solution that might not be the best one.