# Wix-data insert function doent work

**URL:** <https://forum.wixstudio.com/t/wix-data-insert-function-doent-work/6301>\
**Category:** Ask the community\
**Tags:** code, question\
**Created:** [January 10, 2021, 10:27am UTC](https://forum.wixstudio.com/t/wix-data-insert-function-doent-work/6301 "2021-01-10T10:27:49Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![infoaharoni](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/infoaharoni/32/8770_2.png) [@infoaharoni](https://forum.wixstudio.com/u/infoaharoni)\
**Post date:** [January 10, 2021, 10:27am UTC](https://forum.wixstudio.com/t/wix-data-insert-function-doent-work/6301/1 "2021-01-10T10:27:49Z")

</div>

Hi , iam trying to insert the value “AAPL” into collection named “symtest” by the following function :

```javascript
async function dataInsert() {
 var toInsert = {
 "logo" : "AAPL"
   };
 var response = await wixData.insert("symtest", toInsert);

 return response;

}

```

In the console log i see that everything is ok , i got “cretatedDate” , “updaedDate” and id.

 ![](https://us1.discourse-cdn.com/wix/original/3X/e/3/e352b6ce06401dfda41701921aecfaf6f7dffe5f.png)

But in the collection nothing happened.

---

<div class="post-metadata">

**Author:** ![CODE-NINJA](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/code-ninja/32/110588_2.png) [@CODE-NINJA](https://forum.wixstudio.com/u/CODE-NINJA)\
**Post date:** [January 10, 2021, 10:50am UTC](https://forum.wixstudio.com/t/wix-data-insert-function-doent-work/6301/2 "2021-01-10T10:50:55Z")

</div>

-Did you test it in “previe-mode”, or on “live-site”?  
-Did you synced your live and preview-database?  
-Did you gave all needed permissions?  
-Why do you use RETURN? You need it?

Normal way of inserting DATA into collection…

```javascript

import wixData from 'wix-data';

$w.onReady(async function () {dataInsert()}

function dataInsert() {
 let myCollection = "symtest"
 let toInsert = {"logo" : "AAPL"};

   wixData.insert("myCollection", toInsert)
   .then( (results) => {
     let item = results; 
    console.log(item)
   })
   .catch( (err) => {
     let errorMsg = err;
   });
}

```

---

<div class="post-metadata">

**Author:** ![infoaharoni](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/infoaharoni/32/8770_2.png) [@infoaharoni](https://forum.wixstudio.com/u/infoaharoni)\
**Post date:** [January 10, 2021, 1:34pm UTC](https://forum.wixstudio.com/t/wix-data-insert-function-doent-work/6301/3 "2021-01-10T13:34:16Z")

</div>

Thx Dima , was issue with the live database, i didnt know that i should switch to live database in order to the data.

---

<div class="post-metadata">

**Author:** ![CODE-NINJA](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/code-ninja/32/110588_2.png) [@CODE-NINJA](https://forum.wixstudio.com/u/CODE-NINJA)\
**Post date:** [January 10, 2021, 2:09pm UTC](https://forum.wixstudio.com/t/wix-data-insert-function-doent-work/6301/4 "2021-01-10T14:09:59Z")

</div>

That are always the same problems 😁

1. Syncing DATABASES
2. DATABASE-Permissions
3. READ & WRITE settings of the DATASETs

But i am happy when i could help you.

Good luck and happy coding.

---

<div class="post-metadata">

**Author:** ![stankehl](https://avatars.discourse-cdn.com/v4/letter/s/dec6dc/32.png) [@stankehl](https://forum.wixstudio.com/u/stankehl)\
**Post date:** [August 30, 2021, 5:18pm UTC](https://forum.wixstudio.com/t/wix-data-insert-function-doent-work/6301/5 "2021-08-30T17:18:05Z")

</div>

I’m trying to import data into a collection from an Excel spreadsheet. The collection includes two multi-reference fields which the Velo CSV import function will not handle. So I can import everything except those two fields. It has been suggested that I use the insert function to insert the data from those two fields into the corresponding rows in the collection. Does anyone have a s suggestion for code that would use the CSV file from the Excel spreadsheet as the source for the insert data?

Thanks

---

<div class="post-metadata">

**Author:** ![CODE-NINJA](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/code-ninja/32/110588_2.png) [@CODE-NINJA](https://forum.wixstudio.com/u/CODE-NINJA)\
**Post date:** [August 31, 2021, 9:04pm UTC](https://forum.wixstudio.com/t/wix-data-insert-function-doent-work/6301/6 "2021-08-31T21:04:47Z")

</div>

> **[Velo Tutorial: Importing and Exporting Collection Data with Code | Help Center...](https://support.wix.com/en/article/velo-tutorial-importing-and-exporting-collection-data-with-code#import-code-1)**
>
> Visit the Velo by Wix website to onboard and continue learning.In this article we will demonstrate how to import data into a collection and export data from a c

---

<div class="post-metadata">

**Author:** ![stankehl](https://avatars.discourse-cdn.com/v4/letter/s/dec6dc/32.png) [@stankehl](https://forum.wixstudio.com/u/stankehl)\
**Post date:** [August 31, 2021, 10:55pm UTC](https://forum.wixstudio.com/t/wix-data-insert-function-doent-work/6301/7 "2021-08-31T22:55:36Z")

</div>

@russian-dima Thanks. Found that page yesterday. Also, I accidentaly found the actual format for the CSV file for multi-reference fields using then import button on a collection: [“sys id”,“sys id”,“sys id”, . . .] and it works like a charm.
