Excel formula sintax highlighting
Денис Ревин last edited by
Is there a sintax for Excel formulas?
Terry R last edited by
You might need to expand on detail.
If you mean, does Notepad++ work with Excel files, then no.
Although it can work with CSV files which Excel can also use, but CSV files cannot contain Excel formulae. Notepad++ works with text type files, not binary type files.
Alternatively, if you mean can Notepad++ use excel formulas, then again no, it uses “regular expressions”.
PeterJones last edited by
@Terry-R, yes and no. Yes, doing SaveAs CSV from inside Excel will save the CSV with the values. But if you hand-craft a CSV file like
and open it in Excel, Excel will recognize and treat those as formulas when you open the CSV.
And there are ways to grab the formulas out of Excel and paste them into Notepad++, so it’s not unreasonable to want to be able to do syntax highlighting.
Unfortunately, I do not know of an Excel-forumla syntax highlighter available for download. If you wanted to spend the effort, you could use Notepad++'s Language > Define your language… to bring up the UDL (User Defined Language) dialog, and set up your own keywords, styles, etc.
If you unzip that, then you can use Language > Define your language… > Import … to import the XML from that zipfile. Then, when you have Excel formulas in a given Notepad++ editor, you can select Language > XLF (where the “XLF” will be below the “Define your language…” option; if you don’t see it, you may have to exit Notepad++ and re-run it; I had to when I imported the XLF UDL). Once you manually select that Language (or if you save the file as
.xlf, then it should automatically apply that Language when the file is opened).
Hmm… I think they actually did it the hard way. They listed every function individually as the opening string for a “Folding in code 1 style”, with the “)” to close any of them. But that means that the individual functions aren’t syntax highlighted, which seems to defeat the purpose to me.
I tried the experiment of cutting out all of those from the “open” tab (and temporarily pasting them in a blank NPP window); I then replaced the “Folding in code 1 style: Open:” with just the open parenthesis “(”. Then, in the NPP window, I deleted all the “(”, then copied all the function keywords into the UDL > Keywords Lists > 1st group, and applied a style. I think that would work better for you.
Anyway, good luck.