The Concept
Currently, we are in the process of developing an Angular 1.5.x app and are exploring ways to incorporate a feature that allows users to paste a single column of cells from an excel sheet or another spreadsheet (regardless of row count) into an input field.
Within our data table, there are inline inputs setup as follows:
The concept revolves around pasting data from a single column of a spreadsheet into one of the inputs, with each cell's value being assigned to the corresponding input in descending order. For instance, if a column with values [4.52, 6.235, 9.2301] is pasted into the top input containing 15.23, then 15.23 should transform into 4.52, 3.1234 into 6.235, and 3.1322 into 9.2301. We have figured out how to assign these variables to the inputs but require clipboardData in array format instead of one cohesive string.
The Issue at Hand
We have explored using the ng-paste directive along with the $event.clipboardData property, yet we can only access the data as a string. Although we possess a means of parsing the string, having the elements delivered as an array or list would reduce potential errors on our part when employing delimiters to segment the string.
Linked here is an active plunker showcasing our current efforts.
Below is a sample dataset for copying and pasting into the designated input:
Interestingly, when transferring a column from an excel sheet, it doesn't contain any separators between values. Splitting on the '\n' character works seamlessly when extracting data across multiple columns within a single row. Our aim is to enable users to copy from both horizontal rows and vertical columns; however, the challenge arises due to the lack of delineation when pasting a column from excel.
0.89663.91783.91773.91773.9178
These are the values copied from an excel/google sheet^, but arranging them in a singular column will suffice. Rest assured, the entered data will primarily derive from a spreadsheet source.
A Potential Resolution
Do you have any insights on extracting clipboard data formatted as an array?