# Uploading csv files for import into database

**URL:** <https://forum.servoy.com/t/uploading-csv-files-for-import-into-database/21137>\
**Category:** Questions\
**Created:** [January 12, 2024, 9:36am UTC](https://forum.servoy.com/t/uploading-csv-files-for-import-into-database/21137 "2024-01-12T09:36:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![alasdairs](https://avatars.discourse-cdn.com/v4/letter/a/839c29/32.png) [@alasdairs](https://forum.servoy.com/u/alasdairs)\
**Post date:** [January 12, 2024, 9:36am UTC](https://forum.servoy.com/t/uploading-csv-files-for-import-into-database/21137/1 "2024-01-12T09:36:40Z")

</div>

Hiya,  
I was wondering whether it’s possible to set up a csv/xls(x) file upload in TiNG, that automatically processes all of data within the file for whichever table you select in the database.

I have set up a servoy extra - file upload component but am not sure what the accept value should be for .csv files. I have a rough idea about how I would go about processing the data once it’s been uploaded, but am unsure about how to get the data post upload.

Thanks!  
Alasdair

---

<div class="post-metadata">

**Author:** ![mboegem](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/mboegem/32/4399_2.png) [@mboegem](https://forum.servoy.com/u/mboegem)\
**Post date:** [January 12, 2024, 11:02am UTC](https://forum.servoy.com/t/uploading-csv-files-for-import-into-database/21137/2 "2024-01-12T11:02:38Z")

</div>

Hi Alasdair,

You can just do something like this:

```auto
function onActionUpload(event, dataTarget) {
	plugins.file.showFileOpenDialog(callbackUploadFile);
}

/**
 * @param {Array<plugins.file.JSFile>} _aFiles
 */
function callbackUploadFile(_aFiles) {
	if(!_aFiles.length) {
		return;
	}
	
	// process the file(s)
}

```

So you will click a button that will have the onAction function attached.  
Once the user uploads the file, the callback function will be called and you can process the file like you have in mind.

Hope this helps
