Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- setDir := Quiet@Check[SetDirectory@DirectoryName@$InputFileName, SetDirectory@NotebookDirectory[]]
- path = FileNameJoin[{setDir, "Input Workbook.xlsx"}]
- firsttable = SemanticImport[path, <|"Wine" -> Automatic, "Brand" -> Automatic|>, HeaderLines -> 1]
- secondtable = SemanticImport[path, <|"Brands" -> Automatic, "Color" -> String, "Bouquet" -> String|>, HeaderLines -> 1] // Take[#, 5] &
- rls = Append[# :> {##2} & @@@ Normal[secondtable], _ -> {None, None}] // Dispatch
- wine = firsttable[All, "Wine"];
- wine2 = Table[wine [[i]], {i, 1, Length[wine]}]
- brand = firsttable[All, "Brand"];
- brand2 = Table[brand[[i]], {i, 1, Length[brand]}]
- need = Transpose[{wine2, brand2}]
- ds = Dataset[Join[need, Replace[Normal[firsttable[[All, 2]]], rls, {1}], 2]]
- finaltable = ds[All, <|"Wine" -> 1, "Brand" -> 2, "Color" -> 3, "Bouquet" -> 4|>]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement