Jump to content

Scripting import of multiple files in a folder


This topic is 5508 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hi all. Is it possible to create a script to import multiple Excel files within a specific directory? All the files will contain the same fields and mapping. The catch is that the names and number of files may change.

Ideally i would like a script that can point to a location and will import each file in that location, regardless of their names or how many there are.

Thanks for any help.

Link to comment
Share on other sites

you could with a plugin. (FileManipluator) or others

you would choose a folder or directory the plug-in would grab the path to that location

the plug-in could grab the file listings of that directory then with that data in a variable

you could process down the list of file that will import a directory of excel files.

Link to comment
Share on other sites

  • 10 months later...

Yes, you're missing something, and you've come very close to the answer, with this, "specify a variable as a parameter to execute an import".

The "variable" you need is a script Variable. It is a script step (in that top section). You set a script variable to the path (in FileMaker syntax) of the file, including the prefix needed: "file:" for relative path, "filewin:/" (or "filemac:/") for an absolute path.

A script variable's name starts with either "$" (local to script) or "$$" (global). You'd likely use $.

Once the variable is set you can use it directly in the file path dialog of the Import step. Use it straight, i.e., no quotes, ex., $filepath. (This also works in other path dialogs, Export, etc.).

But, seriously, with so much work needing to be done to the files, I would consider something like the Troi File plug-in (or other).* It is somewhat expensive, but it can do your substitutions in the file itself, before importing.

*On a Mac I would just use built-in shell commands, via AppleScript. I imagine Windows scripting experts could do the same.

Link to comment
Share on other sites

  • 1 month later...

Speaking of Windows scripting...

I have multiple .csv files to be imported - the filenames are different each time.

I use this script to concatenate all .csv files into one "allorders.csv", and then import that.

cd DATABASESOrderDBOrderFiles

del allorders.csv

copy /y esellerate*.csv allorders.csv

The only problem is that the first row of the 2nd file is concatenated directly onto the last row of the 1st file (no CR break to make a new row).

I'd love to find a way to insert a CR in between the files. Any ideas?

Link to comment
Share on other sites

This topic is 5508 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.