Forum Discussion

KHANOS123's avatar
KHANOS123
New Member
1 year ago

import files .dat

how to import files by .data. In my attempts, the best I managed was to import csv files, but the result is as follows. I can't duplicate columns to configure the file.

 

 

3 Replies

  • Ray_Minds's avatar
    Ray_Minds
    Solution Supplier

    Hi KHANOS123 

    Power BI cannot directly read or import files with a .data extension.
    To handle this we can convert .data files into  common format like CSV or Excel, which Power BI can handle.

     

    Here's a step-by-step guide

     

    1.Convet .data file to CSV, 
    - Open the .data file in a text editor (like Notepad or any code editor).
    - Save the file as a CSV (Comma-Separated Values) file. Ensure that the columns are separated by commas and each row is on a new line.

     

    2.Import CSV File: 
    -Use Power BI and import the CSV file.

     

    3.Duplicate Columns in Power Query Editor:
    -In the Power Query Editor, select the column you want to duplicate.
    -Right-click on the column header and select "Duplicate Column".

     

    4.Load Data:
    -Once you've made the necessary changes, click "Close & Load" to load the data into Power BI



    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • dk_dk's avatar
    dk_dk
    Super User

    Hi KHANOS123 

    It would help to know what is inside your .dat file. Can you view it in a text editor?

  • Anonymous's avatar
    Anonymous
    Not applicable

    Thanks for the reply from KHANOS123 , please allow me to provide another insight:

    Hi, KHANOS123 

    The method I have found to be most effective involves first saving the file as a .txt document, followed by importing it to the desktop:

    1.Open the date file using Notepad, then save it as a .txt file.

    2.Next, import the file on the desktop using the text/csv format.

    3.Below is my sample data:

    This is the final result, which I hope meets your requirements.

    4.For further considerations regarding this method, please refer to:

    Power Query Text/CSV connector - Power Query | Microsoft Learn
     

    Please find the attached pbix relevant to the case.

     
    Of course, if you have any new discoveries or questions, please feel free to get in touch with us.
     

    Best Regards,

    Leroy Lu

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.