# ImportBase Javascript SDK

**[ImportBase](https://importbase.app)** is an **embeddable CSV importer** designed to help your users import spreadsheet data into your product. It works out of the box and takes just 10 minutes to set up.

You can embed the **ImportBase importer** in your product by using our JavaScript SDKs. Click here if you're looking for the **[React SDK](https://github.com/importbase/react)**.

To get your **Client ID**, **[create an account](https://service.importbase.app/auth)**.

Check out our **[documentation here](https://docs.importbase.app)**.

If you ever get stuck or need any help, feel free to click the chat button on our **[website](https://importbase.app)**, and we'll assist you.

## Installation

### Node.js

```bash
npm install @importbase/importer
```

### Browser (JavaScript)

```html
<script src="https://cdn.jsdelivr.net/npm/@importbase/importer@latest" type="text/javascript"></script>
```

## Usage

### Node.js

```javascript
import ImportBase from "@importbase/importer";

var importer = new ImportBase({
    mode: 'development',
    clientId: "YOUR_CLIENT_ID",
    templateKey: "YOUR_TEMPLATE_KEY",
    onSuccess: (importedData) => console.dir(importedData),
    onError: (err) => console.log(err),
    onClose: () => { /* do something */ },
});

importer.launch();
```

### Browser (JavaScript)

```html
<script type="text/javascript">
  var importer = new ImportBase({
    mode: 'development',
    clientId: "YOUR_CLIENT_ID",
    templateKey: "YOUR_TEMPLATE_KEY",
    onSuccess: (importedData) => console.dir(importedData),
    onError: (err) => console.log(err),
    onClose: () => { /* do something */ },
  });

  importer.launch();
</script>
```
