Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.
Hola chicos, necesito ayuda.
Necesito leer una carpeta que tiene muchos archivos de texto.
De esos archivos, sólo quiero la primera línea e ignorar las otras líneas.
Entonces necesito obtener unos 20 campos, que son posicional, como:
columna 1 a 3 - ID de cliente
columna 4 a 10 - nombre del cliente
columna 11 tp 17 - estado del cliente
¿Es posible?
¡Gracias!
Hola @efilipe ,
¿Qué te parece esto?
O bien, puede hacer referencia a este post para obtener algo como a continuación y luego transponer su tabla.
let
filesInFolder = Folder.Files("D:\Folder Test\"),
GetFirstRowOfCsv = (someFile as binary) as list =>
let
csv = Csv.Document(someFile, [Delimiter=" ", Encoding=65001, QuoteStyle=QuoteStyle.Csv]),
promoted = Table.PromoteHeaders(csv, [PromoteAllScalars=true]),
firstRow = Table.ColumnNames(promoted)
in firstRow,
firstRowExtracted = Table.AddColumn(filesInFolder, "firstRowExtracted", each GetFirstRowOfCsv([Content]), type list),
combined =
let
columns = firstRowExtracted[firstRowExtracted],
headers = List.Transform(firstRowExtracted[Name], each Text.BeforeDelimiter(_, ".txt")),
toTable = Table.FromColumns(columns, headers)
in toTable,
#"Transposed Table" = Table.Transpose(combined)
in
#"Transposed Table"
Saludos
Icey
Si este post ayuda,entonces considere Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.
Acabo de darme cuenta de que puedo dividir el texto después de importarlo. Así que el problema es conseguir sólo ethe primera línea de cada archivo de texto.
Check out the November 2023 Power BI update to learn about new features.
Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.