You of course can do this with script. Generally the process involves these steps:
- Place a <input type=file> control on a miniature form somewhere
- When a file is selected you read it using the FileReader API
- When the FileReader object is loaded you process the file's contents by parsing the CSV into an array of objects with one object per line of CSV. The parsing is done using D3's CSV method
- Now you iterate through the array changing the format of every numberr in parentheses into a number formatted with a leading minus sign (any and other transofmration you want to make on the data - this is a very general processing procedure)
- Reassemble the data into a blob of CSV and import using the API method API_ImportFromCSV
It may sound complicated but the
APIs (
FileReader API, API_ImportFromCSV) and
libraries (
D3, jQuery, Underscore) involved make for a writing a small amount of code because they operate at higher levels of abstraction. Most of the steps outlined above are implemented in a couple of lines of code.
I should also mention that when you use script you achieve your original objective and make future tasks and implementing additional features easy work because the script you use is infinitely adaptable to the new purpose. In other words , when using script you
don't encounter
arbitrary limitations or hit
random ceilings (like the number for form rules allowed).
If you need individual assistance with this task please feel free to contact me off-world using the information in my profile:
https://getsatisfaction.com/people/dandiebolt