jsonkenl / xlsxir

Xlsx parser for the Elixir language.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

multi_extract no function clause matching "def to_charlist(string) when is_binary(string)"

kbrown-axio opened this issue · comments

I'm seeing an unexpected behavior with a particular spreadsheet. Will updated as I discover possible if there is anything particular about this spreadsheet.

iex(3)> {:ok, tid} = Xlsxir.multi_extract(xlsx_file)
** (FunctionClauseError) no function clause matching in String.to_charlist/1

The following arguments were given to String.to_charlist/1:

    # 1
    %Xlsxir.XlsxFile{
      worksheet_xml_files: [
        %Xlsxir.XmlFile{
          name: "sheet4.xml",
          path: nil,
          content: "<?xml version=\"1.0\" encoding=\"UTF-8\" ...
        },
        %Xlsxir.XmlFile{
          name: "sheet1.xml",
          path: nil,
          content: "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\r\n<worksheet xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" xmlns:r=\"http://schemas.openxmlformats.org/ ...
        },
        %Xlsxir.XmlFile{
          name: "sheet2.xml",
          path: nil,
          content: "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\r\n<worksheet xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" xmlns:r=\"http://schemas.openxmlformats.org/ <> ...
        }
      ],
      shared_strings_xml_file: %Xlsxir.XmlFile{
        name: "sharedStrings.xml",
        path: nil,
        content: "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\r\n<sst <> ...
      },
      styles_xml_file: %Xlsxir.XmlFile{
        
        ...

        F\"/><xcalcf:feature name=\"microsoft.com:LAMBDA_WF\"/><xcalcf:feature name=\"microsoft.com:ARRAYTEXT_WF\"/></xcalcf:calcFeatures></ext></extLst></workbook>"
      },
      styles: #Reference<0.253553389.3350331393.1920>,
      workbook: #Reference<0.253553389.3350331393.1922>,
      shared_strings: #Reference<0.253553389.3350331393.1915>,
      max_rows: nil,
      extract_to: :memory,
      extract_dir: nil,
      options: []
    }

Attempted function clauses (showing 1 out of 1):

    def to_charlist(string) when is_binary(string)

(elixir 1.15.4) lib/string.ex:2577: String.to_charlist/1
(xlsxir 1.6.4) lib/xlsxir/unzip.ex:70: Xlsxir.Unzip.validate_path_all_indexes/1
(xlsxir 1.6.4) lib/xlsxir/xlsx_file.ex:231: Xlsxir.XlsxFile.extract_all_xml_files/2
(xlsxir 1.6.4) lib/xlsxir/xlsx_file.ex:63: Xlsxir.XlsxFile.initialize/2
(xlsxir 1.6.4) lib/xlsxir.ex:229: Xlsxir.multi_extract/5
iex:3: (file)

Update: Same behavior on new spreadsheet with 2 cells. So could be a dependency or environmental problem. 🤷

Update: "path: nil" looks sus especially given:

Attempted function clauses (showing 1 out of 1):

def to_charlist(string) when is_binary(string)

(elixir 1.15.4) lib/string.ex:2577: String.to_charlist/1
(xlsxir 1.6.4) lib/xlsxir/unzip.ex:70: Xlsxir.Unzip.validate_path_all_indexes/1

working now. errors are not informative if the application has not been started.