question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can you define multiple ranges in the utility functions?

See original GitHub issue

For example: ws['!ref'] = "D1:E5,B12:D18"

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
SheetJSDevcommented, Mar 30, 2017

You want the second approach:

var XLSX = require('xlsx');
var wb = XLSX.readFile('WLAC-CurricStrengthening-Film.xlsx');
var ws = wb.Sheets['Local Share LMI'];

/* first part */
ws['!ref'] = "D1:E5"; // change the range to the first block
var o1 = XLSX.utils.sheet_to_json(ws);

/* second part */
ws['!ref'] = "B12:D18"; // change the range to the second block
var o2 = XLSX.utils.sheet_to_json(ws);

var output = o1.concat(o2);

And output is:

[
  { 'TOP Code(s)': '61220', 'Program Title': 'Film Production' },
  { 'TOP Code(s)': '614', 'Program Title': 'Graphics and Digital Imagry' },
  { 'SOC Code': '274011', 'Occupational Title': 'Audio/Video Equipment Technicians', 'Annual Openings': '914' },
  { 'SOC Code': '499096', 'Occupational Title': 'Riggers', 'Annual Openings': '67' },
  { 'SOC Code': '393092', 'Occupational Title': 'Costume Attendants', 'Annual Openings': '218' },
  { 'SOC Code': '274032', 'Occupational Title': 'Film and Video Edior', 'Annual Openings': '910' },
  { 'SOC Code': '271027', 'Occupational Title': 'Set and Exhibit Designers', 'Annual Openings': '222' },
  { 'SOC Code': '472141', 'Occupational Title': 'Painters, Construction, Matinenance', 'Annual Openings': '1658' }
]
0reactions
nickfoglercommented, Mar 30, 2017

Awesome, thank you!!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Is there a better way to determine multiple ranges of character?
You can call AddRange to add as many ranges as you want, then you can check if a number is in range. RangeCollection...
Read more >
Refer to Multiple Ranges | Microsoft Learn
By using the appropriate method, you can easily refer to multiple ranges. Use the Range and Union methods to refer to any group...
Read more >
Is there any way to set different values for multiple ranges all ...
Based off the accepted answer I created utility functions to work with ranges (and also named ranges since that's how I'm specifying the ......
Read more >
How to make multiple user defined function and use...
Hi,. Basically, i am trying to calculate deflection of a beam by using Mathcad. But I cant define my range variable with units...
Read more >
Utility in Economics Explained: Types and Measurement
Utility is an economic term referring to the satisfaction received from consuming a good or service.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found