Mon fichier est un.xlsx. Voici les premières lignes du code M
let
Source = Excel.Workbook(File.Contents("W:\Commercial\COMMUN_GMS_DDS\F.D.V\TABLEAU DE BORD FDV\Report_BO\Tableau de Bord FDV Total_BO.xlsx"), null, true),
#"Total à plat_Sheet" = Source{[Item="Total à plat",Kind="Sheet"]}[Data],
#"Changed Type" = Table.TransformColumnTypes(#"Total à plat_Sheet",{{"Column1", type any}, {"Column2", type text}, {"Column3", type text}, {"Column4", type text}, {"Column5", type text}, {"Column6", type text}, {"Column7", type text}, {"Column8", type text}, {"Column9", type text}, {"Column10", type text}, {"Column11", type text}, {"Column12", type text}, {"Column13", type text}, {"Column14", type text}, {"Column15", type text}, {"Column16", type text}, {"Column17", type text}, {"Column18", type text}, {"Column19", type text}, {"Column20", type text}, {"Column21", type text}, {"Column22", type text}, {"Column23", type text}, {"Column24", type text}, {"Column25", type text}, {"Column26", type text}, {"Column27", type text}, {"Column28", type text}, {"Column29", type text}, {"Column30", type text}, {"Column31", type text}, {"Column32", type text}, {"Column33", type any}, {"Column34", type any}, {"Column35", type any}, {"Column36", type any}, {"Column37", type any}, {"Column38", type any}, {"Column39", type any}, {"Column40", type any}, {"Column41", type any}}),
#"Removed Top Rows" = Table.Skip(#"Changed Type",1),
#"Promoted Headers" = Table.PromoteHeaders(#"Removed Top Rows", [PromoteAllScalars=true]),
#"Renamed Columns" = Table.RenameColumns(#"Promoted Headers",{{"Sales Office", "DR"}, {"Sales Group", "RS"}, {"Cust.", "N° Client"}, {"Cust. Name 3 (Key)", "Nom client"}, {"Sales Dir", "Activité"}, {"Order Seasonal/Non Seasonal", "Permanent / Saisonnier"}, {"Order Type", "Type de Cde"}, {"Header Material", "Réf Présentoir"}, {"Header Material Name", "Nom du présentoir"}, {"Material", "Réf SAP"}, {"Material EAN", "EAN"}, {"Cust. Material From Doc", "FICA Client"}, {"Désignation longue", "Désignation produit"}, {"VAL_YTD-1", "CA YTD-1"}, {"VAL_YTD", "CA YTD"}, {"VAL Discr. N YTD", "Ecart CA YTD €"}, {"QTY_YTD-1", "Qtés YTD-1"}, {"QTY Discr. N YTD", "Ecart Qtés"}, {"VAL_Y-1_Fullyear", "CA Full Year-1"}, {"QTY_Y-1_Fullyear", "Qtés Full Year-1"}}),
#"Changed Type1" = Table.TransformColumnTypes(#"Renamed Columns",{{"Qtés YTD-1", Int64.Type}, {"QTY_YTD", Int64.Type}, {"CA Full Year-1", Currency.Type}, {"Ecart CA YTD €", Currency.Type}, {"CA YTD", Currency.Type}, {"CA YTD-1", Currency.Type}, {"Qtés Full Year-1", Int64.Type}}),
#"Renamed Columns1" = Table.RenameColumns(#"Changed Type1",{{"VALOB_Y", "CA en Portef."}}),
#"Changed Type2" = Table.TransformColumnTypes(#"Renamed Columns1",{{"CA en Portef.", Currency.Type}, {"Ecart Qtés", Int64.Type}})
in
#"Changed Type2"