smallex v0.2.3 Excel
Excel library.
Link to this section Summary
Link to this section Functions
Link to this function
load(path, sheet_name)
Load
Parameters
- `path` : Excel(.xlsx) file path
- `sheet_number` : Sheet number (0-origin)
Examples
iex> Excel.load( "test/test.xlsx", "sheet1" )
%{
"columns" => [ "id", "name", "age" ],
"rows" =>
[
[ "1", "John Smith", "49" ],
[ "2", "Zakk Wylde", "45" ],
[ "3", "piacere", "44" ],
]
}
iex> Excel.load( "test/test.xlsx", 0 )
%{
"columns" => [ "id", "name", "age" ],
"rows" =>
[
[ "1", "John Smith", "49" ],
[ "2", "Zakk Wylde", "45" ],
[ "3", "piacere", "44" ],
]
}
iex> Excel.load( "test/test.xlsx", 1 )
%{
"columns" => [ "id", "name", "lots" ],
"rows" =>
[
[ "1", "River", "30" ],
[ "2", "Soil", "34" ],
]
}
Link to this function
load_map(path, sheet_name)
Load map
Parameters
- `path` : Excel(.xlsx) file path
- `sheet_number` : Sheet number (0-origin)
Examples
iex> Excel.load_map( "test/test.xlsx", "sheet1" )
[
%{ "age" => "49", "id" => "1", "name" => "John Smith" },
%{ "age" => "45", "id" => "2", "name" => "Zakk Wylde" },
%{ "age" => "44", "id" => "3", "name" => "piacere" }
]
iex> Excel.load_map( "test/test.xlsx", 0 )
[
%{ "age" => "49", "id" => "1", "name" => "John Smith" },
%{ "age" => "45", "id" => "2", "name" => "Zakk Wylde" },
%{ "age" => "44", "id" => "3", "name" => "piacere" }
]
iex> Excel.load_map( "test/test.xlsx", 1 )
[
%{ "id" => "1", "lots" => "30", "name" => "River" },
%{ "id" => "2", "lots" => "34", "name" => "Soil" }
]
Link to this function
sheet_names(path)
Get sheet names
Examples
iex> Excel.sheet_names( "test/test.xlsx" )
[ "sheet1", "sheet2" ]