/    Sign up×
Community /Pin to ProfileBookmark

scan EXCEL Using JavaScript

Hi ALL,

I am New to javascript, please help me.

I got a situation in which I have to scan an excel file containing Three big columns as mentioned below.
col1:First name
col2:Last name
col3:UID

I have to get input from user which is FN,LN and I have to return corressponding UID as output.

How to do this !!!!

Please Help Me

Thanks

?

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@007JulienMar 19.2013 — Save your file as comma separated value (cvs or txt file) use a textarea to paste the file and work with javascript (use a split(/[rn]+/g) to get an array of lines and an other split in a loop for the three fields).
Copy linkTweet thisAlerts:
@vinayreddyauthorMar 19.2013 — Thanks for the reply

I will try using split and update you
Copy linkTweet thisAlerts:
@vinayreddyauthorMar 19.2013 — I am able to search a single column using the below code.

How to extend this as to search two columns and give the corresponding 3rd column as output


function searchExcel()

{

var searchPhrase = document.getElementById('searchPhrase').value;

var Worksheet = 'C:example.xls';

var Excel = new ActiveXObject('Excel.Application');

Excel.Visible = false;
var Excel_file = Excel.Workbooks.Open(Worksheet, null, true, null,
"abc", null, true, null, null, false, false, null, null, null);

var range = Excel_file.ActiveSheet.Range('A:A');
var jsRangeArray = new VBArray(range.Value).toArray();

var found = false;
for(cells in jsRangeArray)
{
if(jsRangeArray[cells] == searchPhrase)
{
document.getElementById("results").innerHTML = "Found";
found = true;
}
}

if(found == false)
{
document.getElementById("results").innerHTML = "Not Found";
}

Excel.ActiveWorkbook.Close(true);
Excel.Application.Quit();
Excel = null;

}

Works fine in IE
Copy linkTweet thisAlerts:
@rnd_meMar 19.2013 — I am able to search a single column using the below code.

Works fine in IE[/QUOTE]


that code will always only work in IE, and i doubt anyone will help you with it.

if you could use a CSV file instead of a XLS file, i will be more than happy to help.
×

Success!

Help @vinayreddy spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...