• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Read/Write Excel files
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Read/Write Excel files


  • Subject: Re: Read/Write Excel files
  • From: Paul Berkowitz <email@hidden>
  • Date: Tue, 07 Nov 2000 18:57:29 -0800

On 11/7/00 1:43 PM, "Shane Stanley" <email@hidden> wrote:

> On 8/11/00 4:34 AM +1000, Paul Berkowitz, email@hidden, wrote:
>
>> If you open for access and read an Excel file, the result is a
>> comma-delimited text file, where every paragraph after the first has a
>> numerical content or a \"quotation-enclosed-for-text\" content.
>
> I think what you're dealing with there *is* a text file -- a comma-separated
> file saved by Excel (check its file type). It's not really a native Excel
> file.

That is indeed the case. It's some sort of file emanating from a Windows
computer and appearing as an Excel file, but it's actually "TEXT". If you
open it by double-clicking it, it _does_ appear as an Excel Worksheet,
however! Since it's actually fated to be imported into FMP, I'm going to
read it as a comma-delimited text file, manipulate it as such, and import it
into FMP as such. That way it doesn't have to be opened up in Excel, which
just might error the script if the window takes too long to open.
>>
>> Is there a way of writing such a similarly-formatted text back to an empty
>> "XCEL"-created file, and have it fill the cells correctly?
>
> It's just an ordinary text file with creator "XCEL".
>
>> It would be much faster than adding the exact same item to the
>> last column of each row, row-by-row, in Excel.
>
> Well, yes. But so would something like:
>
> set Value of Range "R1C1:R20C1" to "42"
>
> You just need to know the column, and get the number of rows.

Yes, I tried something like that already. Jed Verity told me about using
"Formula" with Range, which also worked well (getting UserRange of the
original file to start out with). One thing I found awkward was that I
couldn't get Name of Range, when wanted to get something like your
"R1C1:R20C1" to use in putting it back into a different file. It was always
part of the Worksheet it belonged to. I.e.

set ur to UserRange of Worksheet 1 of Workbook 1
--Range "R1C1:R51C7" of Worksheet "FileName" of Workbook "FileName"

So when I added a column to ur and wanted to put it into a new File as

Range "R1C1:R51C8" of Worksheet "NewFile" of Workbook "NewFile"

I couldn't get that "R1C1:R51C7" property on its own:

Name of ur
-- Error: Can't get Name of ...

I had to do it by counting the Columns and Rows of ur and fitting them into
"calculated" name:

set lr to (count Rows of ur)
set lc to (count Columns of ur)
set lc to lc + 1

set newRangeName to "R1C1:R" & lr & "C" & lc
set Range newRangeName of Worksheet "NewFile" of Workbook "NewFile" to
ur

By rights, I should have also had to get Column and Row of the first
Worksheet to make sure it began at R1C1. There must be a easier way to do
this?


--
Paul Berkowitz


  • Follow-Ups:
    • Re: Read/Write Excel files
      • From: Shane Stanley <email@hidden>
References: 
 >Re: Read/Write Excel files (From: Shane Stanley <email@hidden>)

  • Prev by Date: Re: Another FMP question
  • Next by Date: Re: Another FMP question
  • Previous by thread: Re: Read/Write Excel files
  • Next by thread: Re: Read/Write Excel files
  • Index(es):
    • Date
    • Thread