Hi, you may go through this link, where there's a detailed information to process fixed length files. https://learn.microsoft.com/en-us/azure/data-factory/how-to-fixed-width If your requirement is different, as Nandan has requested, please share a sample file with details. Thanks.
Data factory read file by position
Hello, I have a txt file with several columns, and there is no delimiter. We find the columns by index (position). How can I read this file from a data factory and copy the contents into a table with several columns Thanks,
Azure Synapse Analytics
Azure Data Factory
3 answers
Sort by: Most helpful
-
Subashri Vasudevan 11,306 Reputation points Volunteer Moderator
2024-02-18T12:37:37.1766667+00:00 -
Emilio Salas Roura 65 Reputation points
2024-02-19T05:40:36.19+00:00 Yes, that's exactly what I'm trying to do. But when I want to test this example I had this error.
Importing the projection. Where can I see the error details (view notification)
-
Pinaki Ghatak 5,690 Reputation points Microsoft Employee Volunteer Moderator2024-04-08T08:32:03.82+00:00 Hello @Emilio Salas Roura
To read a text file with several columns and no delimiter, you can use the Custom delimited format in the Azure Data Factory. In this case, you can specify the column widths as the delimiter.
Here are the steps to do this:
- Create a new dataset in your Azure Data Factory and select the
Azure Blob Storageconnector as the source. - In the dataset settings, specify the path to your text file in the
File pathfield. - In the
Formatsection, selectCustom delimitedas the format. - In the
Column delimiterfield, specify the column widths as the delimiter. For example, if your first column is 10 characters wide and your second column is 5 characters wide, you would specify "10,5" as the delimiter. - In the
Schemasection, specify the column names and data types for each column in your text file. - Create a new dataset for your destination table in Azure SQL Database and select the
Azure SQL Databaseconnector as the sink. - In the dataset settings, specify the table name and the Azure SQL Database linked service.
- In the
Mappingsection, map the columns from your source dataset to the columns in your destination table. Once you have created both datasets, you can create a pipeline to copy the data from your source dataset to your destination dataset using theCopy Dataactivity. In theCopy Dataactivity, select your source and destination datasets and specify any additional settings, such as the frequency of the copy operation.
I hope this helps! Let me know if you have any further questions.
- Create a new dataset in your Azure Data Factory and select the