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

Error "The argument is invalid or missing or has an incorrect format." in Worksheet.getRanges #5198

Closed
matthiasgemmel opened this issue Dec 16, 2024 · 5 comments
Assignees
Labels
Area: Excel Issue related to Excel add-ins Needs: attention 👋 Waiting on Microsoft to provide feedback Status: in backlog Issue is being tracked in the backlog but timeline for resolution is unknown

Comments

@matthiasgemmel
Copy link

Provide required information needed to triage your issue

Workshhet.getRanges returns error "The argument is invalid or missing or has an incorrect format." for a range address with multiple areas. But the limit of getRanges is unclear. With some addresses more than 500 areas work, with some not.

Your Environment

  • Platform [PC desktop, Mac, iOS, Office on the web]: PC desktop, Office on the web
  • Host [Excel, Word, PowerPoint, etc.]: Excel
  • Office version number: Microsoft® Excel® for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20648) 64-bit
  • Operating System: Windows 11 23H2
  • Browser (if using Office on the web): Chrome Version 131.0.6778.86

Expected behavior

An explanation when to split areas into multiple ranges.

Current behavior

Worksheet.getRanges returns an error without knowing what caused the error. The range address string is valid. The sample yaml contains one range with 513 areas that fails and another one with 513 that works. Thus area count seems not to be the issue. The failing range has total address string length of 8207. But a third example has 649 areas with total address string length 9085 which works for me in Excel Desktop (just tested this one fails as well with the same error in Excel Online).

Steps to reproduce

  1. Open attached yaml in script lab
  2. Click button "Try coloring 513 areas"

Link to live example(s)

yaml attached to thus bug report
Error_in_Worksheet.getRanges.zip

@microsoft-github-policy-service microsoft-github-policy-service bot added the Area: Excel Issue related to Excel add-ins label Dec 16, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs: attention 👋 Waiting on Microsoft to provide feedback label Dec 16, 2024
@RuizhiSunMS RuizhiSunMS added Needs: author feedback Waiting for author (creator) of Issue to provide more info and removed Needs: attention 👋 Waiting on Microsoft to provide feedback labels Dec 17, 2024
@RuizhiSunMS
Copy link
Contributor

Hi @matthiasgemmel, thx for reaching out here. I did a try and was able to repro. Mark it as #9628123 into our backlog. I will involve experts to investigate. Will reply here if any update.

@microsoft-github-policy-service microsoft-github-policy-service bot added the Status: no recent activity Issue or PR is stale (no recent activity) label Dec 21, 2024
@matthiasgemmel
Copy link
Author

matthiasgemmel commented Dec 23, 2024

Thanks for letting me know you involved the experts. Happy to hear from them soon.

@RuizhiSunMS , I hope this was sufficient to not auto close this bug while waiting for the Microsoft experts to comment on this bug.

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs: attention 👋 Waiting on Microsoft to provide feedback and removed Status: no recent activity Issue or PR is stale (no recent activity) Needs: author feedback Waiting for author (creator) of Issue to provide more info labels Dec 23, 2024
@RuizhiSunMS RuizhiSunMS added Status: in backlog Issue is being tracked in the backlog but timeline for resolution is unknown and removed Needs: attention 👋 Waiting on Microsoft to provide feedback labels Dec 23, 2024
@RuizhiSunMS
Copy link
Contributor

Thanks for letting me know you involved the experts. Happy to hear from them soon.

@RuizhiSunMS , I hope this was sufficient to not auto close this bug while waiting for the Microsoft experts to comment on this bug.

don't worry, no case would get closed automatically except it is tagged as 'need author feedback' for a long time.

@SiruiSun-MSFT
Copy link

Hi @matthiasgemmel,

Based on our investigation, there indeed exists a limitation on 8192 characters for the address string in this API you used。 And it shares the same limitation with formula limitation of Excel Application.
If your input has over the limitation, sometimes it will hit some cutoff issue and trigger a invalid input error.
Thanks for catching this issue! We will update the detailed info about this limitation to our public document later!

Thanks again!

@SiruiSun-MSFT SiruiSun-MSFT added the Needs: author feedback Waiting for author (creator) of Issue to provide more info label Jan 7, 2025
@matthiasgemmel
Copy link
Author

Hi @SiruiSun-MSFT,

Thanks for your answer and sharing the magic number 8192. Address strings with a length greater than this might work but it is not guaranteed. But address strings with a length lower than 8192 will always work. This is the important part for me. I will change the algorithm to cut strings into multiple ones if their address length exceeds 8192 characters. The const working_649Areas_stringLength9085 in my sample would then be split into two although it would work as one. But that is fine for me,

I tested the change of the algorithm with my test workbook I used to extract the sample shared here. All cases work as expected without an error. Thus I close this issue as completed.

Best regards
Matthias

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs: attention 👋 Waiting on Microsoft to provide feedback and removed Needs: author feedback Waiting for author (creator) of Issue to provide more info labels Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Excel Issue related to Excel add-ins Needs: attention 👋 Waiting on Microsoft to provide feedback Status: in backlog Issue is being tracked in the backlog but timeline for resolution is unknown
Projects
None yet
Development

No branches or pull requests

3 participants