Applescript to read Excel sheet

Hi All,
I'm a learner of applescript and I have a problem to solve so any help will be very appreciated.
I have thousands of photographies in a folder called "images0". I just want to organize this photos by customer (every customer has its own folder)
I have an Excel sheet with this information: column A: CustomerId / column B: photography name / and column C: name of folder (customer)
How can I read this Excel sheet to make an applescript that automatically move every picture to its correct folder?
Thank you very much to everybody!
Alex

Hi all
I have reached to create what I asked for by taking examples from internet. I have done it step by step following my needs and for sure there is a better and easy way to do it but it works anyway!
Now I want to create a repeat (loop) for that script but I do not reach to make it work!
I have done the script with this features:
1. Open and filter an Excel file with a given value through a dialog box
2. Select the rows filtered and create a txt file with these content on it (the content are files names)
3. Create a folder with the same name as the given value in step 1
4. Move files from the source folder to the destination folder
Anyone could help me please?
Here you are the script:
property c1 : "A"
property r1 : 1
tell application "Microsoft Excel"
  --open workbook workbook file name "Macintosh HD:Users:Alex:Desktop:Libro2.xlsx"
  activate object worksheet "Hoja1"
  set mycriteria to text returned of (display dialog "Num client" default answer "" buttons {"OK"} default button 1)
  autofilter range range "A:B" field "1" criteria1 mycriteria
  set {tRow, tCol, lastCell} to {first row index, first column index, last cell} of range object of autofilter object of active sheet
  select range (((get address of cell (tRow + 1) of column (tCol + 1))) & ":" & (get address of lastCell))
  copy range selection
  tell application "Finder"
  --set theDestinationFolder to "Macintosh HD:Users:Alex:Desktop" --choose folder
  set source_folder to "Macintosh HD:Users:Alex:Desktop:Images:FotoFinder2007:images0" as alias
  --make new folder at theDestinationFolder with properties {name:mycriteria as string}
  tell application "TextEdit"
  open file "Macintosh HD:Users:Alex:Desktop:direcciones.txt"
  activate
  tell application "System Events"
  keystroke "a" using {command down}
  keystroke "v" using {command down}
  keystroke "s" using {command down}
  end tell
  tell application "Finder"
  set thefoldername to mycriteria
  set this_folder to "Macintosh HD:Users:Alex:Desktop:Fotofinder"
  set theFolder to (make new folder at this_folder with properties {name:thefoldername})
  set source_folder to "Macintosh HD:Users:Alex:Desktop:Images:FotoFinder2007:images0" as alias
  set the_files to every paragraph of (read (file "Macintosh HD:Users:Alex:Desktop:direcciones.txt"))
  repeat with this_file in the_files
  try
  move item this_file of source_folder to theFolder --with properties {name:mycriteria as string}
  end try
  end repeat
  end tell
  end tell
  end tell
end tell
(*set theDestinationFolder to desktop --choose folder
tell application "Finder"
  --repeat with theIncrementValue from 1 to 10
  make new folder at theDestinationFolder with properties {name:mycriteria as string}
  --end repeat
end tell*)

Similar Messages

  • Reading excel  sheet from out side of the server though sql developer.

    Hi ALL,
    Is it possible to read the excel sheet from the out side of the oracle server.
    If it possible please send me the sample code.

    Duplicate thread.
    Reading excel  sheet from local system though sql developer
    Also a FAQ
    SQL and PL/SQL FAQ

  • Read Excel sheet in KM using API.

    Hi all,
    I kept one Excel sheet (Xsl file) in KM. I want to read that Excel (Xsl) file by using API in NWDS.
    How to read ? Is this possible
    Helpful answer will be appreciate
    Thanks & Regards
    Thillai J

    Hi Thillai
    It is possible to read the files using any of the Java Excel API's ( like POI or JExcel or JDBC-ODBC bridge). It depends on your convenience and requirement as to which one to choose for.
    [POI|http://poi.apache.org/] is seem to be widely used.
    In your case, the sequence of actions will be as follows:
    1. Access the resource and get the content.
    2. Get an InputStream from the content object.
    3. Next, using this InputStream, the data can be read.
    4. Refer to [this|http://www.javabeat.net/articles/41-apache-poi-reading-excel-sheet-using-java-1.html] link as to how read data. (It is assumed that you have successfully retrieved the InputStream in Step 2)
    Hope that helps.
    Thanks
    Deepak

  • How to open and read Excel Sheet from SharePoint 2013 Document Library using C# Visual Studio 2012

    Hi,
    To achieve these are the steps that I had followed :
    1. Add the document Library path into Central Admin -> Application Mgmt -> Manage Service App -> Excel Service App -> Trusted File Locations
    2. Add Documnet Library link to Trusted Connection Proivder
    3. Open Visual Studio as Run as Administrator
    4.Create an SharePoint 2013 Empty Project.
    5.Add Service Reference : http:\\<server>\_vti_bin/excelservice.asmx
    6.Service added successfully
    7.Create a class file and add the Service Reference namespace
    There is no such class as ExcelService to call. 
    Please let me know if somebody knows how to open the Excel file into C#(2012)  either using ExcelService or any other way to open. I tried old methods of Sharepoint 2010 server but it's not able to access classes.
    Requirement is :
    Need to read the excel sheet  from Document Library and transfer all data into DataTable.
    Please help asap. 

    Hi,
    This is the forum to discuss questions and feedback for Microsoft Office, I'll move your question to the SharePoint 2013 development forum
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/home?forum=sharepointdevelopment
    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.
    George Zhao
    TechNet Community Support

  • Reading Excel sheet data in WebDynpro Java Application

    Hi,
    I need to read an excel file which is stored locally in my computer. How to use upload UI element (in WebDynpro Java) ?
    After reading the excel file the data is displayed in table structure in WD Java application. After doing some calculations on click of generate excel button the table data is translated into excel sheet. How to achieve this?
    Thanks,
    Anmol

    Hi,
       Hope the below links helps...
    Re: upload & download files 
    https://wiki.sdn.sap.com/wiki/display/WDJava/Uploading%20excel%20file%20using%20WebDynpro%20for%20Java
    http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=(J2EE3417600)ID0729285250DB01215080400348251106End?blog=/pub/wlg/6603
    Thanks,
    Prakash

  • Reading Excel sheet the corresponding value

    the corresponding value of another colum should be read from excel sheet .
    soppose there are 4 coloumns and i enter the value of column one then colun 2,3,4 value should be read
    Thanks
    Sharad.

    Duplicate post.

  • Read excel sheet using jexcel

    i use a jexcel to read excel file
    i down a package named : jxl.jar
    this my code :
    public static void readFile() throws BiffException
    Workbook w;
    try {
    w = Workbook.getWorkbook(new File("C:/remon.xsl"));
    Sheet read_sheet=w.getSheet("Sheet1");
    int cols = read_sheet.getColumns();
    int rows = read_sheet.getRows();
    Cell cell = null;
    for (int j= 1; j < rows; j++) {
    for (int i = 1; i < rows; i++) {
    cell = read_sheet.getCell(j, i);
    catch (IOException e) {
    System.out.println("2");
    and this the error :
    Class jxl.read.biff.BiffException not found in try.
    *try {*
    *^*
    plza help
    Edited by: romee on May 13, 2008 2:24 PM

    I want to read the contents of an MS Excel file from
    java, is it possible using JavaBeans-ActiveX bridge or
    by any other java technologies, if possible, how ?Bridge2Java from IBM Alphaworks will do the trick for you.
    You can get it from here:
    http://www.alphaworks.ibm.com/aw.nsf/techs/bridge2java
    Using it, you can do things like the following (taken and abbreviated from the samples provided with the package):
    import Excel.*;
    public class QuickExcel
        public static void main(java.lang.String[] args) {
            Application app;
            Workbooks wbs;
            Workbook wb;
            Worksheet sheet;
            Range rangeA1, rangeA2;
            try
                com.ibm.bridge2java.OleEnvironment.Initialize();
                app = new Application(); // Excel.Application !!! :-)
                app.set_Visible(true);
                wbs = app.get_Workbooks();
                wb = wbs.Add();
                sheet = new Worksheet(wb.get_ActiveSheet());
                rangeA1 = sheet.get_Range("A1");
                String out = new String("This is a test");
                rangeA1.set_Value(out);
                // Wait five seconds
                Thread.sleep(5000);
                // Close the workbook without saving
                wb.Close(new Boolean("false"));
                app.Quit();
            } catch (com.ibm.bridge2java.ComException e)
                System.out.println( "COM Exception:" );
                System.out.println( Long.toHexString((e.getHResult())) );
                System.out.println( e.getMessage() );
            } catch (Exception e)
                System.out.println("message: " + e.getMessage());
            } finally
                app = null;
                com.ibm.bridge2java.OleEnvironment.UnInitialize();
    }

  • Help:NoSuchMethodError thrown when reading excel sheet  using jxl API

    I'm trying to read data from an Excel-2003 sheet using this code:
    15. File file = new File("EmpDetails.xls");
    16. jxl.Workbook workbook = jxl.Workbook.getWorkbook(file);                              
    17. jxl.Sheet sheet = workbook.getSheet(0);
    18. jxl.Cell cell1 = sheet.getCell(0,0);I'm getting this java.lang.NoSuchMethodError: common.Assert.verify(Z)V. The StackTrace is given below:
    Exception in thread "main" java.lang.NoSuchMethodError: common.Assert.verify(Z)V
         at jxl.read.biff.SSTRecord.getString(SSTRecord.java:417)
         at jxl.read.biff.LabelSSTRecord.<init>(LabelSSTRecord.java:56)
         at jxl.read.biff.SheetReader.read(SheetReader.java:306)
         at jxl.read.biff.SheetImpl.readSheet(SheetImpl.java:611)
         at jxl.read.biff.WorkbookParser.getSheet(WorkbookParser.java:204)
         at com.scjp.IO.ExcelJXL.main(ExcelJXL.java:17)Please help.

    Thanks a lot for the reply.
    I had both jxl.jar and xlrd.jar in the classpath and xlrd.jar was loaded before jxl.jar.
    There is a conflicting common.Assert.class file in xlrd.jar and there is no verify method in it.
    That was creating the problem. I loaded the jxl.jar file before the xlrd.jar and it is working fine.
    Thanks a lot for the help!!! :)

  • Read Excel sheet contents using java/javabeans

    I want to read the contents of an MS Excel file from java, is it possible using JavaBeans-ActiveX bridge or by any other java technologies, if possible, how ?

    I want to read the contents of an MS Excel file from
    java, is it possible using JavaBeans-ActiveX bridge or
    by any other java technologies, if possible, how ?Bridge2Java from IBM Alphaworks will do the trick for you.
    You can get it from here:
    http://www.alphaworks.ibm.com/aw.nsf/techs/bridge2java
    Using it, you can do things like the following (taken and abbreviated from the samples provided with the package):
    import Excel.*;
    public class QuickExcel
        public static void main(java.lang.String[] args) {
            Application app;
            Workbooks wbs;
            Workbook wb;
            Worksheet sheet;
            Range rangeA1, rangeA2;
            try
                com.ibm.bridge2java.OleEnvironment.Initialize();
                app = new Application(); // Excel.Application !!! :-)
                app.set_Visible(true);
                wbs = app.get_Workbooks();
                wb = wbs.Add();
                sheet = new Worksheet(wb.get_ActiveSheet());
                rangeA1 = sheet.get_Range("A1");
                String out = new String("This is a test");
                rangeA1.set_Value(out);
                // Wait five seconds
                Thread.sleep(5000);
                // Close the workbook without saving
                wb.Close(new Boolean("false"));
                app.Quit();
            } catch (com.ibm.bridge2java.ComException e)
                System.out.println( "COM Exception:" );
                System.out.println( Long.toHexString((e.getHResult())) );
                System.out.println( e.getMessage() );
            } catch (Exception e)
                System.out.println("message: " + e.getMessage());
            } finally
                app = null;
                com.ibm.bridge2java.OleEnvironment.UnInitialize();
    }

  • How to Read Excel Work Sheet Name

    Hi
    I am try to read Excel sheet from SAP B one. any one tell me how to get the Sheet name through Programmatically in C#....
    Senthil Kumar

    There are two ways you can do that:
    #1
    A - put the budget.htm file on your server where you can link to it.
    B - on the web page add an HTML snippet with the folloiwng code:
    <iframe height="XXXpx" allowTransparency="true" frameborder="0" scrolling="no" style="width:XXXpx;border:none" src="URL TO BUDGET.HTM FILE"></iframe>
    Set the width and height, in pixels, so that the snippet will display the entire table.
    #2
    A - open the budget.htm file with a text editor and copy all of the code.
    B - add an HTML snippet to the iWeb page and paste the code into the snippet.
    An example of both methods are near the bottom of this demo page: Tables.
    With method 1, you can edit or change the table without having to use iWeb. Just replace the budget.htm file with the new and improved version on the server. That will automatically be seen in the published site.
    OT
    Message was edited by: Old Toad

  • Read an excel sheet and selected two columns like A and C will plot as a XY Graph (X as a A column and Y as a C column)

    hi sir i am read excel sheet using labview ,but unable to plot the selected colomns,so its needfull ,please find any body to sollution to the problem .i i already did some part ,it is take  too much delay
    Attachments:
    CSV File to XY GRAPH 13.lvproj ‏9 KB

    shambhulinga a écrit :
    hi sir i am read excel sheet using labview ,but unable to plot the selected colomns,so its needfull ,please find any body to sollution to the problem .i i already did some part ,it is take  too much delay
    First, you are not reading an Excel sheet but a text file (a csv file is a text file). From the listing of the function used (from the lvproj file) you are using the Read From Spreadsheet function, this function will return a 2D array. Use the Index Array function to extract the x and y value columns. Bundle them (using the Bundle function) and wire the output to your XY-Graph.
    Ben64

  • Access excel sheet uploaded in library on sharepoint using sharepoint development

    Hi,
    I have an excel sheet which i have uploaded on sharepoint site as a library.
    now i want to access this excel sheet using sharepoint development(c#).
    Is it possible?
    I have one another query- I want to read excel sheet using sharepoint 2010 development.
    Please help to solve both issues.
    Thanks in advance!
    Regards
    rajni

    Hi rajni,
    According to your description, my understanding is that you want to access the excel files uploaded in a library and read the worksheet data by C#.
    You can read excel file using Excel Services. The Excel Services REST API is a new feature of Excel Services that enables you to access Microsoft Excel workbook data by using a uniform resource locator (URL) address. Using the REST API, you can retrieve
    resources such as ranges, charts, tables, and PivotTables from workbooks stored on SharePoint Server 2010. More inforamtion, please refer to the link below:
    http://msdn.microsoft.com/en-us/library/hh124646(v=office.14).aspx
    There are other useful links about accessing and reading excel file in library, please take a look at:
    http://www.sharepointwithattitude.com/archives/61
    http://www.c-sharpcorner.com/uploadfile/vivekbritish/how-to-downloadread-excel-file-from-sharepoint-library-using-excel-services/
    http://stackoverflow.com/questions/14496608/read-excel-file-stored-in-sharepoint-document-library
    I hope this helps.
    Thanks,
    Wendy
    Wendy Li
    TechNet Community Support

  • Adapter Module (Reading Excel File)

    Hi Guys,
    I followed the Webblog : Read Excel instead of XML through FileAdapter
    For File Adapter Module Development , for reading Excel Sheet.
    Deployment all went fine and when i used in my configuration , file is getting picked up but the xml content is not getting displyed , it says not well formated.Below error is shown in the CC Monitor
    The XML page cannot be displayed
    Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.
    XML document must have a top level element. Error processing resource 'http://pxxxxx:50xxx/mdt/messagecontentservlet?att...
    My coding in nwds
              xmldata =   "<?xmlversion="1.0"encoding="UTF-8"?>
                             + "<ns:"+wb.getSheet(0).getCell(0, 0).getContents() +"xmlns:ns=""
                             + wb.getSheet(0).getCell(1, 0).getContents() + "">"
                             + "<Name>"+ wb.getSheet(0).getCell(1, 2).getContents()
                             + "</Name>" +"</ns:" wb.getSheet(0).getCell(0, 0).getContents()">";
    Kindly suggest if any
    srini
    Edited by: Venkateswarlu Srinivas on Jul 4, 2008 2:47 PM

    try removing the \n you have added in the string

  • Upload and Reading Excel File in Web Dynpro

    Hi all,
    I have a requirement in my application( in 04s), where in, i need to upload an excel from a client through a web dynpro application(using fileupload UI) and read each and every the content of that excel file in web dynpro and process the data accordingly.
    The format of the excel is fixed and pre-defined.
    I went through a lot of blogs, but could not find a direct and exact solution to this requirement.
    Please help me.
    Looking forward to your contribution
    Thank you,
    Gita KC.

    Reading Excel Sheet from Java without using any Framework
    Enhanced File Upload - Uploading and Processing Excel Sheets
    Reading Multiple Sheets of Excel Sheet from Java
    nikhil

  • Can BAM extract data from Excel Sheet?

    Hi,
    Thanks for seeing my message.
    We have huge data in the form of Excel sheet with large number of regular updates every day.
    Can BAM read Excel sheet so I can make a dash board reflecting lot of KPI's to track?
    regards,

    BAM Excel View is a report type in BAM. It does not retrieve data. You might be able to use a BPEL file adapter to read the file and publish data to BAM.

Maybe you are looking for

  • Which team can help if the name of iView is not translated in other languag

    Hi All, Do you know which team can help if the name of iView is not translated in other language such as Portuguese? Thanks, Eda

  • Does anybody know how to Clear the screen in Java?

    Hi guys,In C we use System Clear. In java,which instructions shall i use in order to clear the screen? Thanks,in advance!

  • Safari crashes on reset

    Hello Ever since installing OSX 10.9.2, I have been getting the continuous beachball when resetting safari (v 7.0.2) and having to force quit the app. I've tried deleting caches and .plists as referred to in other related threads but these have not h

  • How connect front panel audio on audigy sb0090 Platinu

    Hello i have an audigy platinum Sb0090 but i don't have the rack creative optional... I would like to connect a front pannel audio from my Super Lanboy Antec. I can't find the schemas of the audigy platinum connectors.Could you help me ?

  • Advice on "image counter"

    Im facing a big project where i need to prosess a big number of images, but i will get payed for only the images which actually needs prosessing(There are about 50 prosent of the total amount that needs work). Do photoshop have a counting system scri