Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/elixlsx/sheet.ex
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ defmodule Elixlsx.Sheet do

case content do
nil -> ""
{:formula, val} -> String.Chars.to_string(val)
_ -> to_string(content)
end
end)
Expand Down
22 changes: 22 additions & 0 deletions test/elixlsx_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,26 @@ defmodule ElixlsxTest do
end
end)
end

test "test csv can export function value" do
csv = Sheet.with_name("A name")
|> Sheet.set_at(
0,
0,
{:formula, "foo"}
)
|> Sheet.set_at(
0,
1,
{:formula, "=HYPERLINK(\"https://www.google.com\", \"Go To Google\")"}
)
|> Sheet.set_at(
0,
2,
{:formula, "bar"}
)
|> Sheet.to_csv_string()

assert csv == "foo,=HYPERLINK(\"https://www.google.com\", \"Go To Google\"),bar"
end
end