blob: 692cda911ab2d220dae293cf0d5f4ad39c744bbf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
let load' : string -> (ImportConf.Syntax.t, string) Result.t =
fun content -> Otoml.Parser.from_string content |> ImportConf.t_of_toml
(** Read the configuration in toml and return the internal representation *)
let load : string -> ImportConf.Syntax.t =
fun content -> Result.get_ok (load' content)
let conf =
load
{|[source]
file = "source.xlsx"
name = "source"
[externals.other]
intern_key = ":A"
file = "other.xlsx"
extern_key = ":C"
allow_missing = false
[externals.last_file]
intern_key = ":other.A"
file = "last.xlsx"
extern_key = ":C"
allow_missing = true
[sheet]
columns = [
":A ^ '_'",
":B",
":last_file.E",
]|}
let external_table_source =
ImportDataTypes.Table.{ file = "source.xlsx"; tab = 1; name = "source" }
let external_table_other =
ImportDataTypes.Table.{ file = "other.xlsx"; tab = 1; name = "other" }
let external_other =
ImportConf.Syntax.Extern.
{
intern_key = Path { alias = None; column = 1 };
target = external_table_other;
extern_key = Path 3;
allow_missing = false;
match_rule = None;
}
let external_table_last =
ImportDataTypes.Table.{ file = "last.xlsx"; tab = 1; name = "last_file" }
let external_last =
ImportConf.Syntax.Extern.
{
intern_key = Path { alias = Some "other"; column = 1 };
target = external_table_last;
extern_key = Path 3;
allow_missing = true;
match_rule = None;
}
|