Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Geography Data Type #1733

Open
tao opened this issue Feb 5, 2020 · 3 comments
Open

Geography Data Type #1733

tao opened this issue Feb 5, 2020 · 3 comments
Labels

Comments

@tao
Copy link

tao commented Feb 5, 2020

I'm trying to read a Geography Cell and I'm having trouble getting the value.

When I parse the excel to json, the cell is returned as {t: "e", v: 15, w: "#VALUE!"}.

How can I get the country from these linked data type cells?

@SheetJSDev
Copy link
Contributor

Most likely the file actually stores an error in the cell and Excel recomputes the value when you open the file. Can you share a sample file?

@tao
Copy link
Author

tao commented Feb 5, 2020

Sure, when you view the file in Excel it shows the country with a little map prefixed.

Screenshot 2020-02-05 at 22 16 16

Countries.xlsx

@SheetJSDev
Copy link
Contributor

So to be clear, this library reads whatever data is stored in the file. It doesn't attempt to perform Excel calculations (we actually have a paid component to handle calculating formula expressions, but that's not the thrust of the issue here).

For example, "Cambodia" is cell B2. The raw xml stored in the file (after prettifying with xmllint --format) for row 2 is:

    <row r="2" spans="1:3" x14ac:dyDescent="0.2">
      <c r="A2" s="2" t="s">
        <v>4</v>
      </c>
      <c r="B2" s="2" t="e" vm="1">
        <v>#VALUE!</v>
      </c>
      <c r="C2" s="2">
        <v>2017</v>
      </c>
    </row>

Cell B2 is very clearly stored with the #VALUE! error, and t="e" notes that the cell is an error cell.

Note: By default, XLSX uses a shared string table, and the "4" in cell A2 is the string at index 4 from the table (which happens to be "Activity One").
C2 is of course the literal number 2017

There may be a way to grab the name "Cambodia" from the value metadata, so we'll keep the issue open, but for now it's behaving as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants