Applescript - coping columns in a new worksheet in Excel 2004

Dear all,
I’m new to Applescript and would appreciate a help on the following:
I'm trying to copy in different worksheets of a new Excel 2004 workbook(New _WB.xls) different columns (blocs of text + data) in the same worksheet (lest’s call it file1 of a workbook named Old_WB.xls). The columns are separated by 2 empty rows.
I've searched solutions online with no luck.  Can anyone show me how to code the solution of this problem in Applescript?
Thanks in advance.
Ghan

well, then you want something like so:
tell application "Microsoft Excel"
          open alias "path:to:workbook"
          set x to value of used range of worksheet 1 of workbook 1
end tell
set block to {}
set idx to 1
repeat with thisLine in x
          if thisLine as list = {"*", "", ""} or thisLine as list = {"", "", ""} then
  -- empty line means end of block; make sure some block has been collected then process
                    if block is not {} then
                              set rowCount to count of block
                              tell application "Microsoft Excel"
                                        tell workbook 1
                                                  set nws to make new worksheet at end
                                                  tell nws
                                                            set name to "file" & idx
                                                            set value of range ("A1:C" & rowCount) to block
                                                  end tell
                                        end tell
                              end tell
                              set idx to idx + 1
                              set block to {}
                    end if
                    if thisLine as list = {"*", "", ""} then
  --all done
                              exit repeat
                    end if
          else
                    copy thisLine to end of block
          end if
end repeat
I've used a "*" character o signify the end of data - you'll need to change that to what you use in lines 9 and 25. Be careful that there's nothing else written outside of the data range because the used range command will pick up on it and goof things up.

Similar Messages

  • How can I create a new worksheet every time that one cell it´s filled

    I was looking in the references formulas and I find the formula "Direcction".
    My goal it´s to create a new worksheet everytime that some cells are filled.
    So I need one formula that alows me to put this reference and open automaticaly a new worksheet and this new table inside of this worksheet.
    It is clair the question?
    Someone can help me wiht that?

    Hi Wayne, Not really, the smaller table it´s not really important, I was trying to do the new sheet with it in that case.
    What I want is to use the dates in the row with the items markeds to create a new worksheet.
    I made an example donw here.
    I have the first table, than from it, I want to do 4 new tables
    I mean, everytime that I finish with one column I want to have a new table (in a new work sheet) with that items markeds.
    Do you think that script it´s possible to solve this?
    How can I do it?

  • Copying Query & Formatting on Worksheet to New Worksheet in Same Workbook

    Hi,
    Can anyone advise me the quickest way to copy a query that is working on one worksheet to a new worksheet. More importantly how do I retain the formatted features of the worksheet from which I am coping from? I have tried to copy the query to a new worksheet which is OK but I cannot seem to retain the format features from the original worksheet. Am I missing something simple?  We are on version 3.5.
    Thanks

    Shanky_621: Thanks for taking the time to help. The following blog article talks about what I'm trying to do:
    http://support.microsoft.com/default.aspx?scid=kb;EN-US;914288
    The goal is to recreate the inefficent plan on a test database without copying the data. The article talks about this as a "statistics only copy".
    You noted, "SQL server generating query plan is internal mechanism into which we cannot interfere unless we use Query hint...". The engine uses statistics and histograms to generate plans then choose the most efficent one for execution. Those statistics
    are generated from data in the database, and that process is done periodically. You don't think the engine actively scans each table in a query each and every time a query is run? Right! That would be crazy. It just checks the stats. What I'm trying to
    do is pull the stats from one database into another. The article does a better job explaining this.
    JRStern (Josh): Yes brother! You understand what I'm trying to do. Like you, I am wrestling with a feature/process I've only read about. The actual execution is... not as expected. I actually just found the article I noted to Shanky. I'm trying that process
    now. I'll tell you how it goes.
    Adam

  • How do I add a new worksheet to an excell file utilizing a template with the report generation toolkit?

    Hello,
    My vi is gathering data from a piece of machinery. At varrious points durring the process, my vi must create printable reports. I am using the report generation tool kit to do this. What I want to do is for every report generated durring the run, add it as a new worksheet in an Excell workbook. My excell template works fine for the initial master report and I can add new data to new worksheets. What I am having a problem figuring out is how do I add the new data to a new worksheet using an excel template? I have 5 different reports that need to be generated at different times with some more often than others. I would like all these reports to be in the
    same master excel file. Thanks in advance
    -Greg
    Gregory Osenbach, CLA
    Fluke

    Hi Greg,
    There is no built-in support in LabVIEW to add a new worksheet to an existing Excel report simply because this functionality does not exist in the Excel application itself.
    My suggestion would be to open up the template you wish to use for the new worksheet. Copy the cells from the template and paste them into your new worksheet that you've created. Then close the original template and you have another copy of the template in which you can populate with data values.
    I have attached an example program of how to Copy and Paste a Cell in Microsoft 97 Using ActiveX in LabVIEW to this post. Hope this helps!
    Kileen C.
    Applications Engineer
    National Instruments
    Attachments:
    XL_cell_copy_and_paste.llb ‏76 KB

  • Is it possible to open a new Worksheet without creating a new *.sql file

    Hello Community,
    Declaimer: It may be a trivial question. I just willing to make SQL Developer my default day to day tool.
    I is possible to open a new Worksheet without creating a new *.sql file. Like in an MS Word. If I just need some space to write something and than destroy the file without saying. I can quickly click < ctrl + N > and get the space.
    In SQL Developer to get a new "space"/work sheet i
    -a- < ctrl + N >
    -b- choose "SQL File"
    -c- confirm default location
    -d- choose the connection to be used (right top conner)
    This process is way to long for getting a new sheet to put write an SQL.
    Can you suggest a better way to get a workspace with current connection assigned in no time (like in MS Word)?
    Please ;)
    Yury

    There is no need to create new .sql file.
    I don't know why you need new SQL Worksheet when you can simply do the space by pressing Enter, but you can open a new one from Tools -> SQL Worksheet. There is also a toolbar button for this.

  • How to compare data between two worksheet in Excel for applescript

    Hi All,
    How to compare the data from two different worksheet in Excel and set the value into one worksheet according to the same name? Here is the example. Worksheet 1 & 2 current we have, the final worksheet is the result we want and the value can be input in worksheet 1. Much appreciate if you can help on it.
    Worksheet 1:
    Name          Number
    Leo                 25
    Jame               55
    Leo                 30
    Jame               60
    Tim                 44
    Tomas             77
    Lyne                35
    Tonny              66
    Jame               22
    Game              88
    Worksheet  2:
    Name          Number  2
    Leo                60
    Jame             150
    Tim                66
    Tomas            88
    Lyne               55
    Tonny            99
    Game             111
    Rusult in Worksheet 1
    Name          Number        Total Number per name in Worksheet 1         Number 2 in Worksheet 2
    Leo                 25                          55                                                        60
    Jame               55                         137                                                       150
    Leo                 30                           55                                                        60
    Jame               60                         137                                                       150
    Tim                 44                          44                                                         66
    Tomas             77                          77                                                        88
    Lyne                35                          35                                                        55
    Tonny              66                          66                                                        99
    Jame               22                         137                                                       150
    Game              88                          88                                                        111

    I'd probably use a database for this, if there's any quantity of data involved here.  Import from Excel into {SQLite, MySQL, PostgreSQL, FileMaker, maybe Core Data}, or pick your preferred key-value store, keep your data in the database, then export or (via ODBC/JDBC) then access live database data from within the spreadsheets.
    Alternatively and if you're looking at small quantities of data (say, less than 10,000 entries, or less than a thousand depending on the language), then just use whatever passes for a key-value store in your preferred scripting language {Python, bash, Lua, or maybe php, AppleScript or Java} and use that.  Export Excel to CSV {gag} or XML, then load that into Python and process as needed, then write out CSV {gag} or XML.
    AppleScript is a scripting language for GUI applications, and also useful for processing events.  If you're not doing that sort of stuff, then there can be other choices, and other choices can often have extensive frameworks and libraries for common tasks.
    Sooner or later, most everybody runs into a wall when using a spreadsheet...  Various folks have encountered those limits and have migrated from spreadsheets to FileMaker databases, and now use a database as the central store for their operations — and that's the other issue that can arise with spreadsheets... Where's the canonical data?

  • HOW CAN I ADD NEW WORKSHEET(TAB) TO EXCEL USING ABAP pROGRAM?

    i want to add new tabs to my excel file using abap.... can someone help me on this?

    hi,
    PERFORM add_worksheet USING 'Test 1'.
    *& Form ADD_WORKSHEET
    FORM add_worksheet USING i_name.
    Add new worksheet
      IF g_first_ws <> 'N'.
        g_first_ws = 'N'.
        GET PROPERTY OF g_excel 'ACTIVESHEET' = g_worksheet.
      ELSE.
        CALL METHOD OF g_worksheets 'Add' = g_worksheet.
      ENDIF.
      SET PROPERTY OF g_worksheet 'NAME' = i_name.
      g_row = 1.
      g_col = 1.
    ENDFORM. " ADD_WORKSHEET

  • Funcionallity "Add Drilldown to characteristic in new Worksheets" crashes

    Hello comunnity,
    in BEx 7 Analyzer I opened a query. In the filter section you have the characteristics to do your OLAP-activities and filtering.
    In the context menu of the characteristics there's the funcionallity "Add Drilldown to characteristic in new Worksheets".
    Some of our users discovered that this funcionallity crashes/is very slow (more than 30 minutes) with some characteristics. Beside aggregates that should not be happening.
    For example with "0calyear" which has about 7 different values it's working within 45 seconds. I can live with that. But taking "0INFOPROV" which should only have 3 different values in that query, it is crashing or taking more than 30 Minutes.
    I have absolutely no idea what's the background to that. I have tried out different queries and the behaviour is more or less the same.
    Got someone an idea how to get that working? Any help is welcome.
    Bye Harry

    Hi,
    As also mentioned by Leszek I also would start with testing if the same problem occurs as well in transaction RSRT when running the underlying query.
    You may also check where the query is "hanging" that long while the problem is actually happning (via transaction SM50/SM66). In case that it is reading from the database (SQL-statement execution) then this indicates a database related problem (see SAP note 1681396).
    BR Bernhard

  • 4.0 EA1 - New Worksheet

    In previous versions if you were on a tab and opened a new worksheet it would open the new worksheet to the right of the one you were focused on. In 4.0 EA1 no matter which existing tab you are on it always seems to open a new worksheet on the right most side.
    The previous functionality was useful as you could then group your tabs together if across multiple instances, now they can get muddled up or i'll have to drag them out to get them grouped together.

    Jeff,
    I appreciate the update and i wasn't really trying to get into "best practices for database development and security for the data dictionary".
    All i was trying to ask/understand is why now certain standard functionality doesn't work any more when logged in as APPS. I would have expected that to get an explain plan i should just be able to get one esp if logged in as APPS but however this is not always the case anymore. I don't have a problem with DB security and am happy for to ask for privileges for things but I'd rather know i need them to use some functionality than have to ask/work it out for myself.
    Thanks
    Paul

  • Create and name new worksheets in existing excel spreadsheet

    Hello-
    I am running LabVIEW 6i and excel2000. I need to write data acquired in LabVIEW to new worksheets of an already existing excel spreadsheet, and also name these new worksheets. I have been able to create the new worksheets but haven't yet figured out how to name them. I'm new to activeX and any help would be greatly appreciated.
    Thank you

    Hi Paul,
    Programming using ActiveX can be tricky, especially knowing just what kind of datatypes the different methods and properties are expecting. There are 2 ways I would recommend for users to find out about ActiveX parameters:
    1. Right-click and choose Help for the specific property/method.
    When you have a method or property selected on the Property or Invoke Node, you can right-click and there will be 2 help options--one for the generic Property Node or Invoke Node, the other for the specific method or property that is selected in the node itself. If you select the help for the specific property/method, a Microsoft Visual Basic Reference Help should appear that will provide you with explanations and examples of the datatypes that method/property is expecting given the object that is in use.
    2. Go to the MSDN Library >> Excel Object Model
    This has an overview of Microsoft's Excel Object Model and will also show you how to use Microsoft's Excel Object Model.
    Keep in mind that because ActiveX can be tricky, NI also offers the Report Generation Toolkit to make programming to Word and Excel much easier! Nice tutorials and examples are provided too.

  • How to Transfer SAP data to perticular Worksheet in Excel file

    Hi,
    I have a requirenment to Transfer SAP data to Perticular WorkSheet in an Existing Excel file, i tries using EXCEL_OLE_STANDARD_DAT but this FM deletes all Existing worksheets in the Excel file and creates only one new worksheet and adds data to it.
    Please Help me to solve this issue.....
    Thanks
    Srilatha

    hello,
    what kinf of data do you need to transfer?
    master data
    or
    payroll results?
    regards
    stefan

  • How can i paste a column of email addresses from an excel spreadsheet into a Mail message To: window

    In the past I have been able to send a group email by copying a column of email addresses from an Excel spreadsheet and pasting it into the To: window of an email message I had composed. I simply dragged my cursor down the column containing the email addresses, right-clicked Copy, put my cursor into the To: window of the email, and hit Paste. Mail recognized the list as a series of email addresses and I was able to hit Send and the email went on its way.
    Today I tried to do this and after I hit Send I got an error message. It appears to me that Mail did not recognize the list as a series of individual email addresses but saw them as one long address; the error message said it "did not appear to be a valid email address". Has something changed in Mail? I recently installed Mavericks!
    I can't be the only one who sends group emails this way. Are others experiencing this problem?

    Now Tony, I know you can't hear my tone on a forum post but I was not complaining, simply stating facts . This change brought several people in my office to a grinding halt in a long established workflow that is really rather simple (and I thought was already assumed from the original post above ):
    1) Select a set of records in FileMaker Pro 12 and export only their e-mail addresses as a CSV file.
    2) Open that CSV file in Excel.
    3) Copy the column of e-mail address.
    4) paste into the appropriate recipient field in Mail.
    5) Send
    If I were to complain it would be about Apple's typically opaque approach to updates. There is no granular explanation of why changes were made or even "what" changes were made.
    Complaining is futile since Apple is Apple and is unlikely to change, but sometimes it is cathartic to "shout into the void" .
    I had thought about doing something with a formula in Excel and your suggestion was simple and helpful. Again, however, it is only a workaround for a long established helpful behavior that Apple has inexplicably broken/removed in Mavericks Mail.
    I, and the other posters here, would love to have the capability back rather than have to add previously unneeded steps to our workflows.
    Ultimately we may add scripting steps to the FileMaker side to export the address lists with commas inserted already if Apple ends up having permanently removed this feature.

  • ALV TO EXCEL PROBLEM? ( 90 COLUMNS ALV CAN'T EXPORT TO EXCEL NORMALLY)

    HI ABAPERS,
    anyone have a alv that have over 90 columns and want to export to excel have experienced abnormal formating (like the header row show only up to 60 column and the rest show up in next row) and the data show in separate line.
    anyway can have a better format?
    also after 90 columns show up on alv, it can't show anymore except modify the layout in run time.
    can we do something before that?
    thanks & regards,
    HOWARD

    Hi HOWARD,
    My Report ouput having more than 90 columns in ALV, while downloading data from ALV to Excel sheet am facing alignment problem. (ie) the output column > 66 are appearing in next line of the excel sheet leads to improper alignment.
    Pls give me a solution as u had already come across this issue..
    Thank & Regards,
    Paramesh.

  • Links in preview don't show template on new page in dreamweaver 2004

    links in preview don't show template on new page in
    dreamweaver 2004?
    I have created new html files using a template, then saved
    the file with a new html name.
    I preview it in my local broswer, the first page I want the
    preview shows uo OK. When I click to link to a new page in my root
    folder, the new page shows up, but not formatted with the template.
    Why and how can I fix this?

    "P@tty Ayers ~ACE"
    <[email protected]> wrote in message
    news:finae3$9vg$[email protected]..
    >
    > "happydreamweaver" <[email protected]>
    wrote in message
    > news:fina1g$9dv$[email protected]..
    >> ?links show new page, but not the template design in
    preview broswer?
    >
    > Not mind reader, need more info. :-)
    Never mind - you already posted this question and got some
    excellent help.
    Patty Ayers | Adobe Community Expert
    www.WebDevBiz.com
    Free Articles on the Business of Web Development
    Web Design Contract, Estimate Request Form, Estimate
    Worksheet

  • MULTIPLE WORKSHEETS PER EXCEL WORKBOOK USING XSLT

    Hi everybody,
    My query is on how multiple worksheets per excel file can be created using xslt programming.
    From my report program i call the xslt transformation passing an internal table. Based on the changes in the values of a particular field in the table, multiple worksheets are to be created in a single excel file.
    A snippet of the code ive generated is displayed below .But i get the error saying its unable to open the file. I need to know where exactly to place the <for-each select> and <worksheet> statements in order to successfully implement the solution. Would greatly appreciate any help offerred in this direction. Thanks
    <xsl:template match="/">
    <workbook>
    <ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
          </ExcelWorkbook>
            <xsl:apply-templates />
    </Workbook>
    </xsl:template>
    <xsl:template match="asx:values">
    <xsl:for-each select="ROWS/ZWORKSHEET">
    <Worksheet ss:Name="FIRSTCOL">
      <Table ss:ExpandedColumnCount="10" x:FullColumns="1"
       x:FullRows="1" ss:DefaultColumnWidth="66" ss:DefaultRowHeight="14.25">
        <Row xmlns="urn:schemas-microsoft-com:office:spreadsheet"
             xmlns:o="urn:schemas-microsoft-com:office:office"
             xmlns:x="urn:schemas-microsoft-com:office:excel"
             xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
             xmlns:html="http://www.w3.org/TR/REC-html40">
          <Cell ss:StyleID="s23"><Data ss:Type="String">SAP Material Number</Data></Cell>
          <Cell ss:StyleID="s23"><Data ss:Type="String">CLP</Data></Cell>
        </Row>
      </Table>
      </Worksheet>
    </xsl:for-each>
    </xsl:template>
    </xsl:transform>

    If the Sales Org values are static, you shold be able to create a variant.  Don't know off what the variable name is off the top of my head, but there should be a variable delivered as part of business content that obtains the current month - look at the 0CALMONTH variables. (May be something like 0CMONTH ?)If you don't see it, maybe that variable activated yet.
    Does just one person run this workbook or are many people?
    If you schedule the query with reporting agent, you should be able to warmup (load the results)to the OLAP cache so when the user runs the querys later, they'll run very quickly, retrieving the data from the OLAP cache.  BEx Broadcaster is a good option too if the criteria for the queries are all known upfront.
    Message was edited by: Pizzaman
    Fogo to ask - are you using hierarchies in the query?  They can have a lot of perfromance impacts on the front end interms of rendering them in Excel.  There are some Front End patches that speed this up quite a bit.

Maybe you are looking for