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

Pivot Table Missing Data on Save #73

Open
ralfzosel opened this issue Feb 5, 2024 · 5 comments
Open

Pivot Table Missing Data on Save #73

ralfzosel opened this issue Feb 5, 2024 · 5 comments

Comments

@ralfzosel
Copy link

Describe the bug
I open a Numbers file that contains a pivot table (doc = Document("dummy.numbers")). When I save this file (doc.save("dummy_new.numbers")) and open it with Numbers, data in the pivot table is missing.

To Reproduce

from numbers_parser import Document

doc = Document("dummy.numbers")
doc.save("dummy_new.numbers")

Expected behavior
The data in the pivot table should not vanish.

Attachments
numbers-files.zip
screenshot_1
screenshot_2
screenshot_3

Additional information

  • numbers-parser version 4.7.1
  • Numbers version 13.2 (7038.0.87)
  • macOS 13.6.4 (22G513) (M2 chip)

When I try to refresh the pivot table in Numbers, a message pops up:

(…) This pivot table uses data that was removed from its source table. (…)

@masaccio
Copy link
Owner

masaccio commented Feb 5, 2024

Thank you for the thorough test case. It does seem that if you accept the refresh and then undo, the resulting data is valid. I can certainly take a look at this though. Might take a few days -- don't know if I will have time this weekend.

@masaccio
Copy link
Owner

masaccio commented Feb 6, 2024

@ralfzosel would you mind expanding on your use case for how you want to edit Numbers documents? There are two options for supporting pivot tables in numbers-parser: leaving pivot tables alone and not trying to rebuild them on save (which is failing) or fully support pivot table creation. The latter would be difficult having taken a quick look at the data structures used. Leaving them untouched would be a quick fix, but I do wonder if references might get broken if rows/columns in source tables are inserted or deleted.

@ralfzosel
Copy link
Author

Basically, I am working with a Numbers file that includes one large table containing all the data and many pivot tables for specific views on that data. Whenever I modify data or add data to the table, Numbers itself does not automatically refresh the pivot tables, so I am used to clicking on them all the time to update them. I guess, if numbers-parser would not touch the pivot tables, it should be fine. I can check out whether there are any problems when data is inserted into or deleted from the table.

@masaccio
Copy link
Owner

masaccio commented Feb 7, 2024

I've added a test to skip modifying pivot tables which was a small change so quicker than I thought. I've tested on your example and it looks good, but I've not tested on larger examples.

It's published as version 4.8.0.

@masaccio
Copy link
Owner

masaccio commented Feb 7, 2024

Actually I tried it on a larger example and it still exhibits the refresh error.

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

No branches or pull requests

2 participants