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

Excel - Slow performance when hiding rows #41

Closed
Danwakeem opened this issue Dec 13, 2017 · 4 comments
Closed

Excel - Slow performance when hiding rows #41

Danwakeem opened this issue Dec 13, 2017 · 4 comments

Comments

@Danwakeem
Copy link

Summary

I am trying to hide a lot of disjoint rows in an Excel spreadsheet and it takes a while to hide all of the rows. (It is totally possible there is a better way to hide all of these I am just not sure what that would be.)

Expected Behavior

I wouldn't have expected it to take so long or maybe I would expect a way to group a set of ranges into one action?

Current Behavior

I loop through a list of rows I need to hide and wait for it to finish. Maybe if there were a way to specify a set of ranges to hide all at once?

Steps to Reproduce, or Live Example

I created a gist with an example for an actual set of hidden rows my application attempted to hide.

The part in question is this bit of code here

return Excel.run(function (ctx) {

  var worksheet = ctx.workbook.worksheets.getActiveWorksheet();
  _.forEach(hiddenRows, function (rowData) {
    var range = worksheet.getRange(rowData.range);
    range.rowHidden = true;
  });

  return ctx.sync()
  .then(function () {
  }).catch(function (err) {
});

Context

My application is trying to pull some accounting data from a oracle database into a spreadsheet for our accounting team. We are trying to auto hide some of the data so they can immediately see the important parts right when the data loads. You can see by the sample data there are a lot of records being inserted into the spreadsheet so hiding some of the data is very important for us.

Also the data is ordered by groupings so combining these all into one hidden section probably isn't an option.

Environment

  • PC desktop, Mac, Office Online: We have accountants that use this application on a wide variety of devices
  • Excel
  • Excel 2016 1705
  • MacOS, Windows 10, Windows 7
  • IE 11, Chrome, Safari, Firefox, Edge

Useful logs

If you run the gist I provided as an Excel Office addin then it will tell you how long a set of hide operations took. On average it is about 2 minutes and 45 seconds.

@sameera
Copy link

sameera commented Dec 14, 2017

Just a thought, would adding an extra "priority" column and applying data filter instead of hiding be a workaround in this case?

@Danwakeem
Copy link
Author

Danwakeem commented Dec 14, 2017

Yeah I could give that a shot. Currently I am not using a table I am just inserting the data directly into the excel spreadsheet rows so I will probably have to switch to using a table for that to work right @sameera?

@Danwakeem
Copy link
Author

Wow, I really appreciate the suggestion on this @sameera. Using tables with a data filter rather than the raw excel rows is about 10,000 times easier than trying to this the way I was doing this before. Thank you!

@sameera
Copy link

sameera commented Dec 15, 2017

Glad it helped!

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