error exist in this line:
export function button1_click(event) {export function importButton_onClick(event) {
you try to use one export inside of another, this is for sure wrong usage…
Copy and paste this instead of all you have in code section:
import wixData from 'wix-data';
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 = "";
}
and, you need button with id “importButton” - and you should add “onClick” event on it