View Source xlerl (xlerl v0.1.0)

API to parse, edit and write xlsx files with xmerl and zip

Summary

Functions

Parses a file binary expecting an xlsx zip file

Extract a single value in a precise locations on a selected sheet

Re-assembles the XLSX zip archive exporting all XML elements in binaries.

Directly inserts values in precise locations on a selected sheet

Functions

Link to this function

add_shared_string(String, Xlsx)

View Source
This function is deprecated. Adds a string to the xl/sharedStrings.xml fileThe new string is inserted at the end of the list and the list length is returned. This should allow the user to just insert the string ID in other cells. Currently, this method is not working properly but may be fixed in future. It could also be embedded in the write call as an optimization..
-spec add_shared_string(String :: binary(), Xlsx :: map()) ->
                           {StringIndex :: string(), NewXlsx :: map()}.
-spec parse({Filename :: file:name(), Binary :: binary()}) ->
               {ok, Xlsx :: map()} | {error, Reason :: term()}.

Parses a file binary expecting an xlsx zip file

Unpacks the zip and returns a map with the parsed content of each file. Internal binary files are left untouched. #{InternalFilenamePath => XmerlParsedContent}
Link to this function

read(SheetName, Column, Row, Xlsx)

View Source
-spec read(SheetName :: string(), Column :: string(), Row :: string(), Xlsx :: map()) ->
              Value :: string().

Extract a single value in a precise locations on a selected sheet

Returns 'empty' if the cell is empty.
-spec render(Filename :: file:name(), Xlsx :: map()) ->
                {ok, {FileName :: file:name(), binary()}} | {error, Reason :: term()}.
Re-assembles the XLSX zip archive exporting all XML elements in binaries.
Link to this function

write(SheetName, Column, Row, Value, Xlsx)

View Source
-spec write(SheetName :: string(), Column :: string(), Row :: string(), Value :: term(), Xlsx :: map()) ->
               NewXlsx :: map().

Directly inserts values in precise locations on a selected sheet

For now it expects sheets with unique names, which might not always be the case.