on InsertData(
SeparatedText,
separator,
NumberOfStartRow,
NumberOfStartCol,
TableRef)
   
set text item delimiters to separator
   
set TextRows to paragraphs of SeparatedText
   
set CountTextRows to count TextRows
   
set CountTextCol to count text items of item 1
of TextRows
   
tell application "Numbers"
      
tell TableRef
        &# 160;
        &# 160;
-- add missing rows
        &# 160;
set CountTableRows to count rows
        &# 160;
set MissingTableRows to ((
CountTextRows + (
NumberOfStartRow - 1)) -
CountTableRows)
        &# 160;
if MissingTableRows > 0
then
        &# 160;   
repeat MissingTableRows times
        &# 160;      
make new row at end of rows
        &# 160;   
end repeat
        &# 160;
end if
        &# 160;
        &# 160;
-- add missing columns
        &# 160;
set CountTableCol to count columns
        &# 160;
set MissingTableCol to ((
CountTextCol + (
NumberOfStartCol - 1)) -
CountTableCol)
        &# 160;
if MissingTableCol > 0
then
        &# 160;   
repeat MissingTableCol times
        &# 160;      
make new column at end of columns
        &# 160;   
end repeat
        &# 160;
end if
        &# 160;
        &# 160;
-- rows
        &# 160;
repeat with r from 1
to CountTextRows
        &# 160;   
tell row (
r +
NumberOfStartRow - 1)
        &# 160;      
set RowContent to text items of item r of TextRows
        &# 160;      
repeat with c from 1
to CountTextCol
        &# 160;        0; 
set value of cell (
c +
NumberOfStartCol - 1)
to item c of RowContent
        &# 160;      
end repeat
        &# 160;      
        &# 160;   
end tell
        &# 160;
end repeat
      
end tell
   
end tell
   
set text item delimiters to ""
end InsertData
Lesezeichen