Home » excel » html – Javascript Searching an Excel file

html – Javascript Searching an Excel file

Posted by: admin April 23, 2020 Leave a comment


I was wondering if it would be possible to use Javascript to search through a column of an excel spreadsheet for a value that matches what a user types into a textbox. If a match is found I’d like to retrieve the row number the match was found on and put that number into a variable. I’m making a small database and would like this site to independent of using a database program like SQL if possible.

Is it possible to accomplish this with javascript? If javascript is incapable of this is there any other scripting language that can handle this task?


How to&Answers:

You can use JavaScript with older versions of Excel. Here’s an example: http://support.microsoft.com/kb/234774

You can use Windows Script Host to run in a shell other than a browser:

Here’s the Excel 2003 API reference:


Scripting Microsoft Excel in JavaScript is a new thing, only Office 2013 supports it. Here is the doc. Here is a useful intro.

For older Office versions, use VBA macros, or write an application in C# which uses Microsoft.Interop, as @PortlandRunner suggested.

UPDATE I forgot to mention that C# is not the only technique to work with Excel files from external code. @KevinCollins is right, there is JScript and VBScript too. For the sake of completeness, I would like to add PowerShell to the list, you can also work with Excel files using PowerShell.