Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-30-2012, 09:17 PM   PM User | #1
Muzz666
New Coder

 
Join Date: Jan 2012
Posts: 22
Thanks: 4
Thanked 0 Times in 0 Posts
Muzz666 is an unknown quantity at this point
Question Shared network folder help needed

Hello everyone I am new to JS and it has been years since I worked with JAVA or HTML but I'm getting back into it for a pet project of mine and could really use some help getting past this small problem in front of me.

ok so here is my issue:
I have an HTML page that will read information from Cells in an MS Excel spreadsheet then will write them to the screen.

This works if I run it localy and use the direct path like C:\MyFolder\ExcelFile.xls

BUT if I try and access the MS Excel spreadsheet from a shared network drive like \\TheComputerName\MyFolder\ExcelFile.xls the JS will not read the file.

SO... I tried to leave the HTML file and the Excel file localy and then tried to open teh HTML file from a shared computer like \\TheComputerName\MyFolder\MyWebFile.html but that wouldn't work ether.


NOW my question to you guys is how can I get my HTML file to read the Excel file from a Network Shared location...
....AND....
....How do open the HTML file from a Shared computer (while still correctly reading the Excel Spreadsheet)

Please help (and use small words and code for my little brain) and thank you.

PS I was wondering if this could even be done in JS, I was wondering if I need to do this in PHP instead which I have NO idea at all.
Muzz666 is offline   Reply With Quote
Old 01-30-2012, 10:23 PM   PM User | #2
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,187
Thanks: 59
Thanked 3,995 Times in 3,964 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
Quote:
Originally Posted by Muzz666 View Post
then tried to open teh HTML file from a shared computer like \\TheComputerName\MyFolder\MyWebFile.html but that wouldn't work ether.
Define "didn't work." Do you mean the page didn't appear at all or the page appeared but couldn't read the Excel?

And I do hope you realize that almost surely you won't be able to work with Excel in any browser except MSIE. It might help if you showed some of the code you are using in your attempts.

Are you treating the Excel as if it were a database, using a JET connection? Or are you opening the Excel directly as an ActiveXObject? Or???
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Old Pedant is offline   Reply With Quote
Old 01-30-2012, 10:56 PM   PM User | #3
Muzz666
New Coder

 
Join Date: Jan 2012
Posts: 22
Thanks: 4
Thanked 0 Times in 0 Posts
Muzz666 is an unknown quantity at this point
Thank you for the quick replay.

I guess I should have been more detailed in my explantion. so i'll give it another try.

Here is the code that I am useing and it works localy.

Code:
<html>
<body>

<BR />
<BR />
Hello World
<BR />
<BR />

<script type='text/javascript'>
<!--
var excel=new ActiveXObject("Excel.Application");
var start_path1="\\TheComputerName";
var start_path2="C:";
var end_path="\\MyFolder\\ExcelFile.xls";
var path=start_path2+end_path;
var book=excel.Workbooks.Open(path);
var sheet=book.Sheets.Item(1);

var col_value="A";
var row_value=2;
var value=sheet.Range(col_value+row_value);

document.write("Cell "+col_value+row_value+" says "+value+"<BR />");
book.Close();
-->
</script>
</body>
</html>

IF I use the start_path1 then then I still get the Active X like normal but I get no print to the screen but if I use the start_path2 then I get the correct print out to the screen.

Now I know that this code is very simplefied that is cause I need to use this to test then I can move on to making things more complicated.

NOTE:
The fourm will not allow me to upload the Excel file.
So to test ityourself you will need to creat the MS Excel file and just type someing into Cell A1 or A2.
Muzz666 is offline   Reply With Quote
Old 01-30-2012, 11:13 PM   PM User | #4
Muzz666
New Coder

 
Join Date: Jan 2012
Posts: 22
Thanks: 4
Thanked 0 Times in 0 Posts
Muzz666 is an unknown quantity at this point
Exclamation My Total plan

Hello All I created a new post so that I could explain just what it is my great plan is.
in MS Excel I have created a list of help documents for my team here at work.
In this spreadsheet I have a col for document name then a col for file name with a link to it on my system as well as other col with detailed info about the documents and what group it applies to and so and so forth.... the end result is I have this spreadsheet with about a dozen col and well over 1,000 rows.

In the past my team has simpely opened the Excel file that was saved on my system through a shared network folder.
So in their run line or Address bar they would enter something like this
Quote:
\\TheComputerName\MyFolder\ExcelDocumentFile.xls
But I am unhappy with the look and feel of MS Excel and would like to create an HTML document that would have all of this information imported into an Array that can be manipulated in a simaler manner to the way it is in Excel.

I am very aware that I might be in over my head but I am willing to work and learn JS but I have to take baby steps to sunderatnd what function does what and then I can put it togeather to make it work once I have all the parts workine like I need them to.
Muzz666 is offline   Reply With Quote
Old 01-31-2012, 03:27 AM   PM User | #5
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,187
Thanks: 59
Thanked 3,995 Times in 3,964 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
Ahh... You need this:
Code:
var start_path1="\\\\TheComputerName";
Remember, in javascript it takes a pair of \\ to make a single \ in the resulting literal string!

When you use "\\TheComputerName", your network reference became \TheComputerName and so of course didn't work.
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Old Pedant is offline   Reply With Quote
Users who have thanked Old Pedant for this post:
Muzz666 (01-31-2012)
Old 01-31-2012, 03:29 AM   PM User | #6
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,187
Thanks: 59
Thanked 3,995 Times in 3,964 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
You can use the JET OLEDB driver to treat Excel as a database (looks like an Access database) and do ADODB operations on it. So you could pull all the excel data into JS easy enough.

But you can't write it back to Excel that way. It becomes a read only system.
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Old Pedant is offline   Reply With Quote
Old 01-31-2012, 05:48 PM   PM User | #7
Muzz666
New Coder

 
Join Date: Jan 2012
Posts: 22
Thanks: 4
Thanked 0 Times in 0 Posts
Muzz666 is an unknown quantity at this point
Thanks for the info on the slashes figured it was something simple.

Sadly Other people are still unable to get the page to display the data from the Spreadsheet from their computer but I think I am on the right track.


As for the other database types you mentioned I have never heard of them and I am not using JS to write anything to the Excel file so that will not be a problem. I will start looking for tutor videos for the ones you mentioned.


NOW do you have any idea why other people wouldn't be able to run this from their computer?

I know I know i'm asking alot but if I don't ask then I can't learn.


Thanks again for the help


_____________________

Update:
If I send them the HTML file and ran from their computer then it will work but if they brows my computer and click the HTML file it will not run the Script.
But hey atleast it's a start

Last edited by Muzz666; 01-31-2012 at 06:18 PM..
Muzz666 is offline   Reply With Quote
Reply

Bookmarks

Tags
access, javascript, network, shared

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:06 PM.


Advertisement
Log in to turn off these ads.