Is there a way to access and read from a CSV file that is stored on iCloud drive, using JavaScript?

I have an application on my iPhone that collects and appends data into a CSV files, and has two options for the storage of said files:

A) Local storage on the phone
B) Cloud-based storage on iCloud

I’d like to write a client-side script in JavaScript that processes the data points in these CSV’s (and puts them onto a chart with Charts.js), but I can’t find a way to access the file.

Is there some kind of API that can provide these options?
Any help is much appreciated 🙂

Thank you all in advance,
Peter