Transforming a text file to a database

In summary: It was very easy to follow and I was done in about 5 minutes.In summary, you can use Excel to separate the contact details into different columns.
  • #1
adjacent
Gold Member
1,552
63
I have a list of contacts like this:
Code:
Name ,Address:House ,Island ,Atoll 	7777777
Name ,Address:House ,Island ,Atoll 	7777777
Name ,Address:House ,Island ,Atoll 	7777777
I have a large number of these and I want the details to be separated to different columns. Is there any program which will do this for me?

I tried searching google and got nothing.
:confused:
 
Computer science news on Phys.org
  • #2
Microsoft Excel's "import wizard" (which you get automatically when you open a text file in Excel) can be used to remove the commas and the colon, and open the file as a spreadsheet. Then you can save it as a tab-delimited text file if that's more suitable for you than an Excel spreadsheet.

The Open Office clone of Excel might have a similar import wizard.
 
  • Like
Likes 1 person
  • #3
Yes, you can do it with Open Office. Open a new spreadsheet and on the main menu click "Insert". Then click "Sheet From File". A dialog box will appear where you can select what delimiters you want to use.
 
Last edited:
  • Like
Likes 1 person
  • #4
adjacent said:
I have a list of contacts like this:
Code:
Name ,Address:House ,Island ,Atoll 	7777777
Name ,Address:House ,Island ,Atoll 	7777777
Name ,Address:House ,Island ,Atoll 	7777777
I have a large number of these and I want the details to be separated to different columns. Is there any program which will do this for me?

I tried searching google and got nothing.
:confused:
If you include the word 'parse' in your search, you will get lots of hits - how to parse a text file.
But, as posted, Excel is quick and easy.
 
  • Like
Likes 1 person
  • #5
Oh, I didn't know Excel was that great :smile:. I think I should learn MS office products more.

Thanks guys.
 
  • #6
I was able to open and fix up your small sample (after copy-and-pasting it into a text file) as I described it, using Excel for Mac 2011. The details may differ for you depending on which version you have, but it took me only a couple of minutes to figure it out in the "wizard."
 
  • #7
jtbell said:
I was able to open and fix up your small sample (after copy-and-pasting it into a text file) as I described it, using Excel for Mac 2011. The details may differ for you depending on which version you have, but it took me only a couple of minutes to figure it out in the "wizard."

Yeah, I got it done too.I opened the text file in excel and the wizard opened :smile:
 

1. How do I transform a text file into a database?

To transform a text file into a database, you will need to use a text editor or scripting language to parse the data from the text file and then use SQL commands to create and populate a database with the data from the text file.

2. What is the benefit of transforming a text file into a database?

Transforming a text file into a database allows for more efficient storage and retrieval of data. Databases are designed for handling large amounts of data and can perform queries and searches much faster than a text file.

3. Can any text file be transformed into a database?

Yes, any text file can be transformed into a database as long as the data is well-structured and can be parsed and organized into database tables.

4. What factors should be considered when transforming a text file into a database?

Some factors to consider when transforming a text file into a database include the structure and format of the data, the size of the data, and the type of database that will best suit the data and its intended use.

5. Are there any tools or software that can assist with transforming a text file into a database?

Yes, there are various tools and software available that can assist with transforming a text file into a database, such as ETL (Extract, Transform, Load) tools, scripting languages like Python or Perl, and database management systems like MySQL or MongoDB.

Similar threads

  • Programming and Computer Science
2
Replies
65
Views
2K
  • Programming and Computer Science
2
Replies
50
Views
4K
  • Programming and Computer Science
Replies
3
Views
214
  • Computing and Technology
Replies
22
Views
2K
Replies
14
Views
2K
  • Programming and Computer Science
2
Replies
57
Views
3K
  • Computing and Technology
Replies
12
Views
1K
  • Computing and Technology
Replies
4
Views
4K
  • Computing and Technology
Replies
10
Views
840
  • Computing and Technology
Replies
8
Views
7K
Back
Top