This is a public Forum  publicRSS

Forum post

    Dasher
    Import from Excel
    Forum post posted March 19, 2009 by Dasher, last edited February 9, 2012 
    445 Views, 9 Comments
    Title:
    Import from Excel
    Post:
    Does anyone know of a way to import two or more worksheets from the same Excel file without having to open the file after each worksheet import? I want to be able to open the file and import data from two different worksheets into two different tables in Filemaker 9.0. Thanks

    Answer

     

    • deltatango
      Are you using the file import menu item? You might want to try dragging the excel file onto the Filemaker Icon. I don't know if this would be different.
    • PhilModJunk

      Not really.

       

      The closest approximation of this that I can come up with is to script it. But then you're still doing it twice, you're just having the script do these two imports in automatic succession for you.

    • Dasher
      Thanks. That's pretty much what I do now. I use a script to import the first worksheet then have it import the second, but I still have to select the Excel file between the first and second import. I've tried, without any luck, to come up with a better way.
    • PhilModJunk
      I gather that it's not the same file name each time. Best fix I can think of is to rename your excel file so that it always has the same name and always resides in the same folder. (You could rename and place copies of your file in a designated folder for example.) Then your scripted import could import the data without ever asking for a filename.
    • Dasher
      Unfortunately, renaming the file is not an option but thanks.
    • PhilModJunk
      Please note that I suggested renaming a copy of your excel file rather than renaming the orignal. That approach can preserve the filenames of your originals. Some savvy developers may have a batch file (windows) or Applescript that can automate the process.
    • comment

      You could have users select the file to import by using the Insert File script step. Use a global container field as the target, and pre-select 'Store only as reference'.

       

      Once you have the reference to the file in the container, you can extract the path using GetAsText (gContainerField), place it into a variable and proceed with the imports.

    • PhilModJunk

      Comment,

       

      I like what I am reading but...

       

      Once I have the file path in a field, how do I use that field in a script that imports data from the file?

    • TSGal

      PhilModJunk:

       

      Since "comment" hasn't responded, I thought I should jump in before more time passes.

       

      Once you have the file path in a field, store the contents of that field into a variable.  For example:

       

      Set Variable ( $path ; "file:" & <fieldname> ]

       

      Then, in the Import Records script step, where you specify the data source, use $path.

       

      TSGal

      FileMaker, Inc.