I am working with an Excel add-in and am given a list of cell addresses that contain custom functions that I need to reference, ie.,
["A1","B1","C1","F2","F3","F4","G2","G3","G4","X5"]
This list of cell addresses can vary from one cell address to a list of many and can vary from a row to a column to every other cell, it's all up to the user for where they place their custom function.
I need to create a list of ranges the same way Excel creates them to display to the user.
So for the example array I would expect my return to be
["A1:C1","F2:G4","X5:X5"].
This would look something like
const exampleCells1 = ["A1","B1","C1","F3","F4","G3","G4","X1"];
const exampleCells2 = ["AN299","AN300"];
const exampleCells3 = ["P44"];
const getRanges = (cells) => {
const ranges = [];
// createRanges
return ranges;
};
//expected returns being
// getRanges(exampleCells1) => ["A1:C1","F3:G4","X1:X1"];
// getRanges(exampleCells2) => ["AN299:AN300"];
// getRanges(exampleCells3) => ["P44:P44"];