简体   繁体   中英

SpecialCells in Excel JavaScript API

In VBA Excel, I can choose cells based if they have formulas or values.

Sub ColorCells()
    Dim rng As Range

    Set rng = ActiveSheet.UsedRange.SpecialCells(xlCellTypeConstants)
    rng.Interior.Color = RGB(200, 200, 200)

    Set rng = ActiveSheet.UsedRange.SpecialCells(xlCellTypeFormulas)
    rng.Interior.Color = RGB(0, 200, 1)
End Sub

Also, I can specify if I want to get only text values, numbers, errors and/or booleans.

How can I do that with Excel JavaScript API? It is a pretty important method. Currently, I'm looping all the worksheet's used range rectangle to get the values, and my loops spend a lot of time in blank cells.

I don't believe the functionality that you've described is currently available in the Excel JavaScript API. If you'd like to add this feature request to Office Developer Platform UserVoice , other users can vote on it there, enabling the Office PM team to get a sense for overall priority/demand as they plan for future enhancements to the API.

Good news ! SpecialCells functionality is in beta now! We now support range areas and also specialCells please give it a try and send us feedback. https://docs.microsoft.com/en-us/office/dev/add-ins/excel/excel-add-ins-multiple-ranges

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM