Urgent:Copy data from notepad/excel..simple though

Discussion in 'Javascript' started by cv, Jul 14, 2003.

  1. cv

    cv Guest

    Hi all,

    I have to copy two set of data from 2 files(notepad/excel) say,
    products and their corresponding prices to list/textarea/table. I
    should be able to retrieve the product and corresponding price
    information from the control(list/textarea/table). Which is the best
    way? Quite urgent.. pls let me know.

    TIA, cv
     
    cv, Jul 14, 2003
    #1
    1. Advertising

  2. cv

    Grant Wagner Guest

    cv wrote:

    > Hi all,
    >
    > I have to copy two set of data from 2 files(notepad/excel) say,
    > products and their corresponding prices to list/textarea/table. I
    > should be able to retrieve the product and corresponding price
    > information from the control(list/textarea/table). Which is the best
    > way? Quite urgent.. pls let me know.
    >
    > TIA, cv


    Open the file in Notepad, select the text you want to copy, select Edit
    -> Copy.

    Go into your favorite web page editor, select Edit -> Paste. Edit as
    required.

    Alternatively you could use File -> Save as HTML in Microsoft Excel,
    then copy and paste the table it creates into your web page editor and
    modify it as necessary.


    The point is, what you want can't be accomplished by client-side
    JavaScript in the default security environment, and although it's
    possible to automate it using either VBScript in Microsoft Excel, or by
    using the Windows Script Host, you'll probably need assistance
    completing the task.

    --
    | Grant Wagner <>

    * Client-side Javascript and Netscape 4 DOM Reference available at:
    *
    http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/frames.html

    * Internet Explorer DOM Reference available at:
    *
    http://msdn.microsoft.com/workshop/author/dhtml/reference/dhtml_reference_entry.asp

    * Netscape 6/7 DOM Reference available at:
    * http://www.mozilla.org/docs/dom/domref/
    * Tips for upgrading JavaScript for Netscape 6/7 and Mozilla
    * http://www.mozilla.org/docs/web-developer/upgrade_2.html
     
    Grant Wagner, Jul 14, 2003
    #2
    1. Advertising

  3. cv

    cv Guest

    Grant Wagner <> wrote in message news:<>...
    > cv wrote:
    >
    > > Hi all,
    > >
    > > I have to copy two set of data from 2 files(notepad/excel) say,
    > > products and their corresponding prices to list/textarea/table. I
    > > should be able to retrieve the product and corresponding price
    > > information from the control(list/textarea/table). Which is the best
    > > way? Quite urgent.. pls let me know.
    > >
    > > TIA, cv

    >
    > Open the file in Notepad, select the text you want to copy, select Edit
    > -> Copy.
    >
    > Go into your favorite web page editor, select Edit -> Paste. Edit as
    > required.
    >
    > Alternatively you could use File -> Save as HTML in Microsoft Excel,
    > then copy and paste the table it creates into your web page editor and
    > modify it as necessary.
    >
    >
    > The point is, what you want can't be accomplished by client-side
    > JavaScript in the default security environment, and although it's
    > possible to automate it using either VBScript in Microsoft Excel, or by
    > using the Windows Script Host, you'll probably need assistance
    > completing the task.
    >
    > --
    > | Grant Wagner <>
    >
    > * Client-side Javascript and Netscape 4 DOM Reference available at:
    > *
    > http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/frames.html
    >
    > * Internet Explorer DOM Reference available at:
    > *
    > http://msdn.microsoft.com/workshop/author/dhtml/reference/dhtml_reference_entry.asp
    >
    > * Netscape 6/7 DOM Reference available at:
    > * http://www.mozilla.org/docs/dom/domref/
    > * Tips for upgrading JavaScript for Netscape 6/7 and Mozilla
    > * http://www.mozilla.org/docs/web-developer/upgrade_2.html


    hi again,
    do you mean to say it is not possible at all to copy/paste a set of
    data like

    123 $
    456 €
    789 @

    like this to a html textbox/html list/html textarea and to get the
    values in the next page after i submit the page??
    thanx for any input, cv
     
    cv, Jul 15, 2003
    #3
  4. cv

    Grant Wagner Guest

    cv wrote:

    > Grant Wagner <> wrote in message news:<>...
    > > cv wrote:
    > >
    > > > Hi all,
    > > >
    > > > I have to copy two set of data from 2 files(notepad/excel) say,
    > > > products and their corresponding prices to list/textarea/table. I
    > > > should be able to retrieve the product and corresponding price
    > > > information from the control(list/textarea/table). Which is the best
    > > > way? Quite urgent.. pls let me know.
    > > >
    > > > TIA, cv

    > >
    > > Open the file in Notepad, select the text you want to copy, select Edit
    > > -> Copy.
    > >
    > > Go into your favorite web page editor, select Edit -> Paste. Edit as
    > > required.
    > >
    > > Alternatively you could use File -> Save as HTML in Microsoft Excel,
    > > then copy and paste the table it creates into your web page editor and
    > > modify it as necessary.
    > >
    > >
    > > The point is, what you want can't be accomplished by client-side
    > > JavaScript in the default security environment, and although it's
    > > possible to automate it using either VBScript in Microsoft Excel, or by
    > > using the Windows Script Host, you'll probably need assistance
    > > completing the task.

    >
    > hi again,
    > do you mean to say it is not possible at all to copy/paste a set of
    > data like
    >
    > 123 $
    > 456 €
    > 789 @
    >
    > like this to a html textbox/html list/html textarea and to get the
    > values in the next page after i submit the page??
    > thanx for any input, cv


    Client-side JavaScript is unable to perform the copy/paste, which is what I thought you wanted. If you want
    to move data from one page to another, you can put whatever data you want in whatever form elements you want,
    then use:

    <form action="nextPage.htm" method="GET">

    On nextPage.html, you'd have:

    var sSearch = window.location.search.substring(1);
    var Parameters = new Object();
    var sNameValuePairs = sSearch.split('&');
    var sNameValuePair;
    for (var i = 0; i < sNameValuePairs.length; i++) {
    sNameValuePair = sNameValuePairs.split('=');
    Parameters[sNameValuePair[0]] = sNameValuePair[1];
    }
    // now each item passed on the URL is in
    // Parameters[itemName]
    // so the value of your parameter can be accessed via
    // Parameters["lastName"]

    Of course, all the data you pasted would be in a single input (Parameters["whatYouPasted"]). You'll have to
    parse it using .split(), then you could document.write() it as an HTML table.

    --
    | Grant Wagner <>

    * Client-side Javascript and Netscape 4 DOM Reference available at:
    * http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/frames.html
    * Internet Explorer DOM Reference available at:
    * http://msdn.microsoft.com/workshop/author/dhtml/reference/dhtml_reference_entry.asp
    * Netscape 6/7 DOM Reference available at:
    * http://www.mozilla.org/docs/dom/domref/
    * Tips for upgrading JavaScript for Netscape 6/7 and Mozilla
    * http://www.mozilla.org/docs/web-developer/upgrade_2.html
     
    Grant Wagner, Jul 15, 2003
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. JDS
    Replies:
    4
    Views:
    8,385
    ForestHonerkamp
    Nov 11, 2008
  2. bala
    Replies:
    0
    Views:
    281
  3. boris
    Replies:
    1
    Views:
    1,914
  4. Mike
    Replies:
    1
    Views:
    159
    Ray Costanzo [MVP]
    Oct 21, 2004
  5. JDS
    Replies:
    3
    Views:
    227
    gnari
    May 24, 2004
Loading...

Share This Page