I am copying and pasting all the code from the page below. Let me know if there is a better way of doing it.
import wixData from ‘wix-data’;
// For full API documentation, including code examples, visit http://wix.to/94BuAAs
$w.onReady(function () {
//TODO: write your page related code here…
});
export function button1_click(event) {export function importButton_onClick(event) {
const items = JSON.parse($w(“#textBox”).value);
const collection = $w(“#collectionInput”).value;
items.forEach( (item) => {
wixData.insert(collection, item)
.then( (results) => {
console.log(Added item: ${JSON.stringify(results)});
} )
.catch( (err) => {
console.log(err);
} );
} );
$w(“#textBox”).value = “”;
}
//Add your code for this event here:
}