Model builder: iterative Excel-file import and Shapefile output

Discussion created by 3ricfinno on Sep 17, 2013
Latest reply on Sep 19, 2013 by ernosson

I'm trying to automate the following process within the model builder:

1. Import Excel xls-files, that each contain point elevation data with x,y and z values
2. Convert them into separate shape files while using the original xls file name as the output file name

Therefore I've setup the following model:

The problem occurs while trying to copy the features to an output shape when using the expression for the new file name. Since for iterating the Excel files I need to activate the Recursive option to scan the worksheets within each xls file. The extracted "File" then contains a "$" at the end to mark the worksheet (so if for instance the input file is 001b.xls, the extracted name within "File" is 001b$).
Because of the error message "000354 : The name contains invalid characters" i assumed that the "$" is the problem and used the Calculate Value tool with   r"%File%".replace("$","")   as an Expression and string as the Data Type. Unfortunately this doesn't help, although the calculated value seems to be correct (without the "$")...

Hence my questions are:
a) What exactly is causing the error and how can I solve it?
b) What other possibilities would I have to manipulate the input file name for output, for instance if I want to use only a part of the name or add an automated counter?

Thanks in advance for any help!