Copy a list into a widget and then insert records for each row

I’m trying to copy a long list of items from a spreadsheet, paste that into a widget, and then upon clicking a button insert the values into a database table. I have tried to implement this by using rich text editor. When you paste the values from a column of a spreadsheet into the widget, they are separated by a new line character. I can then successfully split the data and loop through it, grabbing each value successfully. I’ve tested this by setting a text widget equal to the stored value, and it always updates and ends with the last stored value as its value. I thought I should just be able to execute an sql insert query on each time through the loop. However no matter how I’ve tried, the first row always is inserted successfully, and then the next insert fails (however the loop still processes, because the text value that is set to read from the stored value always updates to the last value in the column. Here is the code I have for the button submit:

{{ function(){
var lines = axsAccountsToAdd.text.split(’
’)

for(var i = 0;i < lines.length;i++){
storeValue(‘axsLoopValue’, lines[i])

axsCreateNewAccountsFunction.run(() => showAlert(’""’,‘success’), () => showAlert(’“error creating accounts.”’,‘error’))

}

}()}}

Why doesn’t this work, and is there an easier way to copy in a list, then insert that list into a table?

Hello, you can achieve this by sending a row to the query when it is run
axsCreateNewAccountsFunction.run(() => showAlert(’""’,‘success’), () => showAlert(’“error creating accounts.”’,‘error’), { line: lines[i] })
and accessing it in the query as
{{ this.params.line }}