4 Replies Latest reply on Feb 11, 2014 6:59 AM by Wiedenmaier

    Retrieving data from Excel file

    Avigail12345 Level 1



      I have an fm file with a list of parameters. I want to read them one by one, and plant their description in the fm file under the name of the parameter. The description is in an excel file. The B column of the excel file contains the name of the parameter, and the C column contains the description I want to fetch. Attached an example:


      Return description in column C

      Where column A = App_GlobalResources\ConfigSetsResources

      AND column B = [name of parameter]



      How do I do this?

        • 1. Re: Retrieving data from Excel file
          4everJang Level 3



          I have been using an Excel file to handle the administration of a repository management system, with hundreds of entries going into the Excel sheet and being read from the sheet by management scripts. I know what it does to the performance of your application.


          My word of advice on this: even though it is technically possible to access an Excel file directly to retrieve the data, I would steer clear of that option. The problem is that you create an enormous overhead for each single read operation on a cell in Excel (an ActiveX or other object must be created that can do almost anything you would ever want to do, including frying some eggs for breakfast).


          The easy way of doing this: save your Excel sheet as CSV file (note that Excel really creates 'SSV' - semicolon separated variables - and does not tell you about this), then make your script read the file line by line as text and use the JavaScript split method to retrieve the separate cells from the original Excel sheet. Works fine, and fast. Several customers for my tailor-made CMS are using this method hundreds of times every day (without ever noticing it).


          Good luck



          • 2. Re: Retrieving data from Excel file
            frameexpert Level 4

            I don't think you can use ActiveX (or COM) objects with FrameMaker's ExtendScript. If so, I would like to know how. I agree with Jang, though. It is pretty easy to parse through a CSV file with ExtendScript.


            FrameScript is much better with ActiveX objects. I have a bunch of FrameScript scripts that read and write to Excel spreadsheets.



            • 3. Re: Retrieving data from Excel file
              Wiedenmaier Level 3

              Hi Rick,


              you are right you don't have such features as ActiveX or COM-Integration with ExtendScript. If you want to have this, you have to use FDK or FrameScript.

              But I found a possibility on how you can get such a connection via external objects. You will find an example here:

              C:\Programme\Adobe\Adobe ExtendScript Toolkit CC\SDK\Samples\cpp

              I think Russ already implemented such a connect in the past. But I think it's a little bit tricky.


              Bye Markus

              • 4. Re: Retrieving data from Excel file
                Wiedenmaier Level 3

                If I have to do such things out from excel I work with Excel XML Calculation Tables (2003) format.Then I use XML Objects of ExtendScript. But it get's a little bit tricky due to that multiple namespaces in the Excel XML format.

                In most cases CSV would be the best and easiest way.

                Hope this helps