Home · Blog · Lesson 8: From Scattered Text to an Organised Table: Shaping Data into a Template!

Lesson 8: From Scattered Text to an Organised Table: Shaping Data into a Template!

By Tanzeel-ur-RahmanCodeHubb & MindCrafts AIFree AI Course اردو میں پڑھیں

Lesson No: 8

From Scattered Text to an Organised Table: Shaping Data into a Template!

By Tanzeel-ur-Rahman (CodeHubb & MindCrafts_AI) Farooka (Sargodha)

Assalamu Alaikum wa Rahmatullahi wa Barakatuh!

Suppose you run a clothing business. Every day, customers send you messages on WhatsApp. One writes:

"Brother! Please send two blue suits to Multan. My name is Asad, phone 03001234567."

Another sends this message:

"My name is Hamid. I need a parcel sent to Lahore Cantt. Black shoes, size 9."

Now you have to pull the customers' names, cities, requested items, quantities and phone numbers out of these messages and enter them into an Excel sheet. If there are many messages, this can take a lot of time, and typing everything in by hand always leaves room for mistakes.

AI can help with tasks like this. You can instruct it to extract the information you need from text written in all sorts of styles and arrange it in a neat table.

This process is called turning Unstructured Text into Structured Data.

In simple terms, when information sits inside loose, scattered writing and we arrange it into fields decided in advance, the data becomes better organised and far more usable.

Let's learn this in practice.

1. How Do We Turn Scattered Text into a Table?

Suppose you have received messages from three customers:

Rashid Mahmood is from Faisalabad. He wants three white kurtas.

Tariq Aziz has ordered one smartwatch for Islamabad.

Bilal is from Gujranwala. He needs two laptop bags.

This information is written in different ways, but all of it has a few things in common: the customer's name, city, requested item and quantity.

If we create a separate column for each of these, the table will look like this:

Serial No. | Name | City | Item Requested | Quantity

1 | Rashid Mahmood | Faisalabad | White kurtas | 3 2 | Tariq Aziz | Islamabad | Smartwatch | 1 3 | Bilal | Gujranwala | Laptop bags | 2

Now all the information is in one orderly arrangement. It is easy to read this table, to look up a customer's order in it, and to use it for further work.

AI can try to do exactly this in a few moments, provided the information you give it is clear and your instructions are accurate.

2. How Do We Instruct AI to Create an Organised Table?

Simply saying "Make a table of these messages" is sometimes not enough to get the result you want. This is the same principle as Lesson 3: the clearer your purpose, role and conditions, the better the answer you get.

It is better to tell the AI three things clearly:

First: What information should be extracted? For example: name, city, requested item, quantity and phone number.

Second: In what order should the information be placed? That is, decide the columns of the table in advance.

Third: What should be done when some information is missing? For example, if a message has no phone number, the AI should write "Not provided" instead of inventing a number.

This small clarification matters, because AI can sometimes try to fill in incomplete information on its own.

3. Practical Exercise: Create a Table from WhatsApp Messages

Open your favourite AI tool and use the prompt below.

Prompt:

> Role: You are a careful data assistant.

Task: Review the messages given below and arrange all the relevant information in a structured table.

Columns: Serial No., Name, City, Item Requested, Quantity, Phone Number.

Conditions:

1. Put each customer's information in a separate row.

2. Place each piece of information in the correct column.

3. Copy phone numbers exactly as they appear in the original message.

4. If any information is missing, write "Not provided".

5. Do not add any name, number or quantity by guessing.

6. In your reply, give only the table.

Messages:

1. "Assalamu Alaikum, I am Rashid Mahmood from Faisalabad. I need 3 white kurtas. Phone 03217654321."

2. "Please send my parcel to Islamabad. Name: Tariq Aziz. 1 smartwatch. Contact: 03339876543."

3. "My name is Bilal, from Gujranwala. I need 2 laptop bags. Phone 03451122334."

After running the prompt, look at the table the AI has prepared.

Are all three customers' names correct? Are the items and quantities recorded correctly? Do all the digits of the phone numbers match the original messages?

Remember: a table that looks neat and well organised is no guarantee that everything in it is correct. This is the golden rule of Lesson 7 — verify important information against the original source.

4. Add a New Column to the Existing Table

Now suppose you also want the province, or the relevant administrative status, shown next to each customer's city.

You do not need to rewrite the whole prompt. In the same conversation, give this instruction:

> "Add a new column, 'Province or Administrative Status', to the existing table. Fill in the correct information for each city. Do not change the information in the other columns. If you are not sure about any piece of information, explain this instead of guessing."

The AI should add the new column to the existing table.

After that, verify the answer too. For example, Faisalabad and Gujranwala are in Punjab, while Islamabad is the federal capital, not a province.

So it would be wrong to write the name of a province next to Islamabad. That is why "Province or Administrative Status" is the more suitable name for the column.

This exercise shows that AI can not only turn scattered information into a table, but can also modify an existing table according to your new instruction.

5. Where Can We Use This Skill?

This ability is not limited to business orders. It can help in many everyday tasks.

In business: Extracting names, contact numbers, orders and quantities from customers' messages.

In educational institutions: Arranging students' names, subjects and marks in a table.

In the office: Pulling out task lists, the people responsible and deadlines from various messages.

In web development: Arranging product details under columns such as name, price, category and so on.

In research: Organising key points, authors' names and related details from various articles.

Once the data is organised, it can also be easy to move it into an Excel sheet or convert it into formats such as CSV and JSON, as needed.

However, if the data is going to be used in a business system, always check the format and the accuracy of the information before importing it.

Lesson Summary

1. Unstructured data is loose, disordered writing; structured data is information arranged in fixed fields. 2. A table is the most common and familiar form of structured data. 3. First understand the layout of the table yourself, then have the AI build it. 4. Tell the AI three things clearly: what information to extract, in what order, and what to do with incomplete information. 5. For incomplete information, instruct the AI to write "Not provided" — stop it from guessing. 6. Check phone numbers and figures against the original message, character for character. 7. A neat-looking table is no guarantee of accuracy — this is the golden rule of Lesson 7. 8. A new column can be added to an existing table in the same conversation. 9. Verify every new piece of information the AI writes (such as the province) yourself. 10. This skill is useful everywhere: business, education, the office, web development and research.

Today's Takeaway and Task

Today's practical task is to choose five messages or sentences from your own daily work in which information is written in different styles.

Instruct the AI to extract the required information from them and make a table.

Then do these three things:

1. Check the names, numbers and quantities in the table against the original messages.

2. Instruct the AI to add a new column to the table.

3. See whether the AI pointed out the incomplete information or tried to fill it in on its own.

Write this in your notebook:

"AI is a useful way to turn scattered writing into structured data, but for better results, clear instructions, suitable columns and verification of the information are essential."

Tell us in the comments: What kind of messages did you build a table from? Did the AI arrange all the information correctly, or did something need fixing?

Tanzeel-ur-Rahman

#Lesson8 #DataStructuring #UnstructuredToStructured #TableGeneration #AIProductivity #PromptEngineering #MindCraftsAI #CodeHubb

Join the WhatsApp channel for all previous lessons, and check the comments for Lesson 7.

Enjoyed this lesson?

The full course is completely free — a new lesson every day on the Facebook Page and WhatsApp channel.