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

Provide access to table definitions like DefinedNames #1454

Closed
chiefgeek157 opened this issue Jan 20, 2023 · 3 comments
Closed

Provide access to table definitions like DefinedNames #1454

chiefgeek157 opened this issue Jan 20, 2023 · 3 comments
Labels
enhancement New feature or request
Projects

Comments

@chiefgeek157
Copy link

Description

It is possible to obtain the list of DefinedNames today, and that works well. In Excel (M365), Name Manager also lists defined Tables as named ranges.

In excelize, there are functions to add tables (AddTable()), but not to retrieve existing tables. Some of the private functions, such as countTables(), appear to be able to access the proper information about tables.

Ideally, existing tables should either be returned in DefinedNames() or in a new function such as Tables().

Tables are a very common structure in many Excel files, and I happen to use them extensively because of their power in providing structured references for use in formula functions such as XLOOKUP.

If this ability is already present, then I apologize for having missed it.

Describe the results you expected:

File.Tables() would return a list of tables defined in the workbook similar to File.DefinedNames(). The returned structure should include at least the name or the table and the reference to be useful, and ideally all the data that could be used in AddTable().

Output of go version:

go version go1.19.5 Darwin/amd64

Excelize version or commit ID:

require github.com/xuri/excelize/v2 v2.7.0

Environment details (OS, Microsoft Excel™ version, physical, etc.):

MacOS 12.6.2, Excel M365 current as of today

@xuri xuri added the enhancement New feature or request label Jan 21, 2023
@xuri
Copy link
Member

xuri commented Jan 21, 2023

Thanks for your issue. The library doesn't support listing table names and ranges currently. I will consider adding this feature.

@chiefgeek157
Copy link
Author

That would be great. I took a look and am not sure I can easily figure out the changes to add this feature, but it looks like the code already examines the tables refs in XML, so I guessing it is very close.

@taomin597715379
Copy link
Collaborator

The new functions GetTables has been added. Now, we can get table name, range, style name, etc., please try to upgrade the master branch code. This feature will be released in the next version.

@taomin597715379 taomin597715379 removed the in progress Working in progress label Aug 23, 2023
jenbonzhang pushed a commit to jenbonzhang/excelize that referenced this issue Oct 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
No open projects
v2.8.0
Features
Development

No branches or pull requests

3 participants