# Importing a txt or csv file

**URL:** <https://forums.thehomestack.io/t/importing-a-txt-or-csv-file/180>\
**Category:** vb.Net\
**Created:** [November 27, 2004, 10:25pm UTC](https://forums.thehomestack.io/t/importing-a-txt-or-csv-file/180 "2004-11-27T22:25:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://forums.thehomestack.io/uploads/default/original/1X/161426793bc0d8bdf0d1a6692b3e44446861cc72.jpeg) [@system](https://forums.thehomestack.io/u/system)\
**Post date:** [November 27, 2004, 10:25pm UTC](https://forums.thehomestack.io/t/importing-a-txt-or-csv-file/180/1 "2004-11-27T22:25:17Z")

</div>

To import into a datatable or dataset

```auto

Dim file As String = "Test2.txt" 
           Dim path As String = "C:\" 
           Dim ds As New DataSet 
           Dim f As System.IO.File 
           If f.Exists(path & file) Then 
              Dim ConStr As String = _ 
              "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _ 
              path & ";Extended Properties=""Text;HDR=No;FMT=Delimited\""" 
              Dim conn As New OleDb.OleDbConnection(ConStr) 
              Dim da As New OleDb.OleDbDataAdapter("Select * from " & _ 
              file, conn) 
              da.Fill(ds, "TextFile") 
          End If 

```
