Created
May 27, 2014 06:36
-
-
Save patcullen/f2ec6470d05708cbc53e to your computer and use it in GitHub Desktop.
An example of connecting to an Excel file in ASP (using JScript)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%@ Language=JScript %> | |
<!--#include file="excel.asp" --><%/* https://gist.githubusercontent.com/patcullen/096a79ca8000b367537e/raw/7a806439bdf388335f2403ba89d8f51f039fb6a8/excel.asp */%> | |
<!--#include file="json.asp" --><%/* https://raw.githubusercontent.com/douglascrockford/JSON-js/master/json2.js */%> | |
<% | |
excelFile = "c:/temp/unlocodes.xlsx" | |
sql = "SELECT [ISO 3166-1], [Country Name] FROM [Sheet1$]" | |
excel.open(excelFile).query(sql, {}, function(codes) { | |
Response.write( | |
JSON.stringify(codes.asArray()) | |
); | |
excel.close(); | |
}); | |
%> |
Thank you for replying, it still did not work I've just followed your algorithm and all is good. thanks again.
i am getting error '80004005' , can you please help
Thank you
I Google'd that and the first few results related to filesystem or OS permissions related to the source of data. I'd suggest you Google it yourself and work through the first page of results. That's usually what I do. I haven't touched the ASP environment in almost 6 years, so can't give much better advice.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In classic ASP only dot-asp files can be included as scripts. So After downloading json2.js, rename it to a dot-asp extension. The contents shouldn't need to be changed. Perhaps adding an ASP-script opening and closing braces. Haven't touched ASP in a few years myself, so can't quite remember. Good luck.