HP Forums
APP spreadsheet insert values [Solved] - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: APP spreadsheet insert values [Solved] (/thread-5296.html)



APP spreadsheet insert values [Solved] - jrozsas - 12-08-2015 10:54 AM

Hi,
In APP spreadsheet, it is possible to make a program to create a spreadsheet and enter a value in cells? Is there any example?
I want to create a program that creates a spreadsheet and enter values in the cells.


RE: APP spreadsheet insert values - cyrille de brébisson - 12-09-2015 05:51 AM

Hello,

Yes, it is.

Make a copy of the spreadsheet app (move cursor on spreadsheet and click on save) (let us call is sscpy)

start the app.
go in the program catalog, click on sscpy program and enter:
START()
BEGIN
local a;
for a:= 1 to 10 do
Cell(a,1):= a^2;
end;
END;

exit the program catalog, back in app view. Now, when you START the app (clicking on the app icon when in the APP catalog only starts the app if it was NOT the current app, so you need first to exit to another app and then return to sscpy), so, when you start the app, it will execute the START function and populate your spreadsheet.

cyrille


RE: APP spreadsheet insert values - jrozsas - 12-09-2015 11:11 AM

(12-09-2015 05:51 AM)cyrille de brébisson Wrote:  START()
BEGIN
local a;
for a:= 1 to 10 do
Cell(a,1):= a^2;
end;
END;



cyrille
Fantastic!
Thanks cyrille, but how to an external program enter the values in the spreadsheet sscpy?


RE: APP spreadsheet insert values - Tim Wessman - 12-09-2015 08:10 PM

(12-09-2015 11:11 AM)jrozsas Wrote:  Fantastic!
Thanks cyrille, but how to an external program enter the values in the spreadsheet sscpy?

That is what the line "Cell(...):=<stuff>" is doing.

Spreadsheet.Cell(1,3):='A1+A2' stores a formula into A3 that will add A1 and A2... and so on.


RE: APP spreadsheet insert values - jrozsas - 12-09-2015 08:32 PM

(12-09-2015 08:10 PM)Tim Wessman Wrote:  
(12-09-2015 11:11 AM)jrozsas Wrote:  Fantastic!
Thanks cyrille, but how to an external program enter the values in the spreadsheet sscpy?

That is what the line "Cell(...):=<stuff>" is doing.

Spreadsheet.Cell(1,3):='A1+A2' stores a formula into A3 that will add A1 and A2... and so on.
Tim,
Do you believe that in the manual in Portuguese, latest version, there is nothing about "Cell"? This information did you get to where? This is the only page that has some information about "Cell" Sad
[Image: ckAcC.jpg]


RE: APP spreadsheet insert values - Tim Wessman - 12-09-2015 08:57 PM

(12-09-2015 08:32 PM)jrozsas Wrote:  This information did you get to where?

The built in calculator help for "Cell references and Cell". You have about a page of text describing it there. To find it most easily, type "Cell" and press your calculator HELP key. It will take you right there where you will find this information:

Quote:In most cases, you will be referencing cells directly by their RC names as in A1 or D6 just like in your usual spreadsheet. Only advanced formulas creators or users that need access to spreadsheet data from outside of the spreadsheet numerical view will need to understand the full complexity of cell references.

Examples:
A1:= 100 stores the value 100 in cell A1.
A1:= A2+A3 stores value of A2+A3 in A1 using the current values of A2 and A3.
A1:= 'A2+A3' sets A1 to the formula A2+A3.

Syntax: Cell(RowNumber, ColNumber, [n])

For slightly more complex formulas, Cell(r, c) where r is a row number and c a column number (A=1, B=2 …) is equivalent to ColNameRowNumber. For example, Cell(1,1) is equivalent to A1.

Valid references are:

[$]R[$]C[(n)] or
[$]CellName[(n)] or

[$]R1[$]C1:[$]R2[$]C2:[(n)] or
[$]CellName1:[$]CellName2[(n)] or a mix of both name and RC syntaxes

[$]R:[$]R[(n)] or
RowName[(n)] or

[$]C:[$]C[(n)] or
ColName[(n)] or

Where R(1/2) is a Row name and C(1/2) is a Column name or number gives full access to a cell or selection definition or to the cell's attributes.

For the Cell access method, note that Cell(0, Col) gives access to the specified column, Cell(Row, 0) gives access to the specified row and Cell(0,0) gives access to the sheet definition itself.


GETTING THE CONTENT OF CELLS AND SELECTIONS:
If n is not specified and the reference is not used as a Sto destination, the value of the cell/selection is returned.

If the reference is to a single cell, the cell value/content/attributes will be returned.
If the reference is to a single row or column, a list of value/content/attributes will be returned, one for each cell.
If the reference is to a selection, a list of list of value/content/attributes will be retuned, one for each column.
Note: a cell with no associated value is considered as having a value of 0.

If n is specified, the table bellow indicates what attribute of the cell will be returned.


MODIFYING THE CONTENT OF CELLS AND SELECTIONS:
If n is not specified and the reference is used as a Sto destination, the expression associated with the cell/selection is modified.

If a single input is used as the source for more than one destination, the input is duplicated for all destinations. If the input is an expression, relative cell references are updated as needed.
For example: A1:=1; A2:A10:='A1+1';

If n is specified, the table bellow indicates what attribute of the cell will be modified.


CELL ATTRIBUTES (n)
-1: all attributes. If the cell has nothing defined, returns -1, else return a list of 11 objects.
0: value (read only, you can not set the cell value)
1: formula
2: name
3: number format: Standard 0, Fixed 1, Scientific 2, Engineering 3, Floating 4, Rounded 5, unspecified –1
4: number of decimal places: 1 to 11, or unspecified = –1
5: font: -1: 0 to 6, unspecified = –1
6: foreground color: contents color (color, or -1 if unspecified)
7: background color: cell fill color (color, or -1 if unspecified)
8: horizontal alignment: Left = 0, Center = 1, Right = 2 , unspecified = –1
9: vertical alignment: Top = 0, Center = 1, Bottom = 2, unspecified = –1
10: show strings in quotes: Yes = 0, No = 1, unspecified = –1
11: textbook mode (as opposed to algebraic mode): Yes = 0, No = 1, unspecified = –1

Note: As a general rule, -1 means: unspecified or auto.



RE: APP spreadsheet insert values - jrozsas - 12-09-2015 11:27 PM

(12-09-2015 08:57 PM)Tim Wessman Wrote:  
(12-09-2015 08:32 PM)jrozsas Wrote:  This information did you get to where?

The built in calculator help for "Cell references and Cell". You have about a page of text describing it there. To find it most easily, type "Cell" and press your calculator HELP key. It will take you right there where you will find this information:

Quote:In most cases, you will be referencing cells directly by their RC names as in A1 or D6 just like in your usual spreadsheet. Only advanced formulas creators or users that need access
Interesting. In Portuguese is not the same. Note the differences in help menu> tree>search:
English:
[Image: gYS2z.jpg] [Image: GjkCH.jpg]
Portuguese:
[Image: 56NuH.jpg] [Image: izStT.jpg]
Is there any way to print everything this that help?


RE: APP spreadsheet insert values - cyrille de brébisson - 12-10-2015 05:57 AM

Hello,

In the emulator, with a help currently displayed, pressing Edit/copy should copy the whole help text in the PC clipboard.

Cyrille


RE: APP spreadsheet insert values - jrozsas - 12-10-2015 10:25 AM

(12-10-2015 05:57 AM)cyrille de brébisson Wrote:  Hello,

In the emulator, with a help currently displayed, pressing Edit/copy should copy the whole help text in the PC clipboard.

Cyrille
But only with the help currently displayed? And print all the help (A-Z - all commands)? We could create a book with that help.


RE: APP spreadsheet insert values - Thomas_Sch - 12-10-2015 10:49 AM

(12-10-2015 10:25 AM)jrozsas Wrote:  
(12-10-2015 05:57 AM)cyrille de brébisson Wrote:  Hello,
In the emulator, with a help currently displayed, pressing Edit/copy should copy the whole help text in the PC clipboard.
Cyrille
But only with the help currently displayed? And print all the help (A-Z - all commands)? We could create a book with that help.
Erwin (eried) did this already:
http://www.hpmuseum.org/forum/thread-4861.html?highlight=reference


RE: APP spreadsheet insert values - jrozsas - 12-10-2015 06:47 PM

(12-10-2015 10:49 AM)Thomas_Sch Wrote:  
(12-10-2015 10:25 AM)jrozsas Wrote:  But only with the help currently displayed? And print all the help (A-Z - all commands)? We could create a book with that help.
Erwin (eried) did this already:
http://www.hpmuseum.org/forum/thread-4861.html?highlight=reference
I noticed something interesting. The "Cell" function does not exist in this PDF. Will other functions are also not in pdf?


RE: APP spreadsheet insert values - Thomas_Sch - 12-11-2015 06:54 AM

(12-10-2015 06:47 PM)jrozsas Wrote:  ..
I noticed something interesting. The "Cell" function does not exist in this PDF. Will other functions are also not in pdf?
We should ask Erwin (eried) in his thread. Maybe the App-functions are mising ?


RE: APP spreadsheet insert values - Terje Vallestad - 12-11-2015 08:32 AM

(12-10-2015 06:47 PM)jrozsas Wrote:  
(12-10-2015 10:49 AM)Thomas_Sch Wrote:  Erwin (eried) did this already:
http://www.hpmuseum.org/forum/thread-4861.html?highlight=reference
I noticed something interesting. The "Cell" function does not exist in this PDF. Will other functions are also not in pdf?

The full Command Tree for 6975 (previous version) can be found in this post http://www.hpmuseum.org/forum/thread-2796.html
It includes the help for cell

Cheers, Terje


RE: APP spreadsheet insert values - jrozsas - 12-11-2015 10:26 AM

(12-11-2015 08:32 AM)Terje Vallestad Wrote:  
(12-10-2015 06:47 PM)jrozsas Wrote:  I noticed something interesting. The "Cell" function does not exist in this PDF. Will other functions are also not in pdf?

The full Command Tree for 6975 (previous version) can be found in this post http://www.hpmuseum.org/forum/thread-2796.html
It includes the help for cell

Cheers, Terje

THANKS Terje! Very important.Exactly what I was looking for.


RE: APP spreadsheet insert values - toshk - 12-14-2015 11:51 AM

i have a list say L1={1,2,3,4} which can vary in size depending on the question.
i want to output this "variable list" into a spreadsheet column A. and possibly from an external app.

//this code crashes prime..............
for a:= 1 to length(L1) do
Cell(1,a):= L1(a);
end;
//...........................................


RE: APP spreadsheet insert values - jrozsas - 12-14-2015 12:37 PM

(12-14-2015 11:51 AM)toshk Wrote:  i have a list say L1={1,2,3,4} which can vary in size depending on the question.
i want to output this "variable list" into a spreadsheet column A. and possibly from an external app.

//this code crashes prime..............
for a:= 1 to length(L1) do
Cell(1,a):= L1(a);
end;
//...........................................
Sintaxe: FOR var FROM início TO fim DO comandos END;
START()
BEGIN
local a;
for a:=1 to length(L1) DO
Cell(a,1):=L1(a);
END;
END;
[Image: O8IYsYc.png]
[Image: NwhtuWx.png]


RE: APP spreadsheet insert values - Tim Wessman - 12-14-2015 09:37 PM

I am unable to see this. I turned on Portuguese just to make sure language wasn't a part.

This was the code I tried in the spreadsheet app function. I had 1 2 3 4 in my list. I also tried with other values, and with an empty list. It works fine with either the Cell(a,1) or Cell(1,a)[/code]

Code:
START()
BEGIN
local a;
for a:=1 to length(L1) DO
Cell(1,a):=L1(a);
END;
END;

[code]
//this code crashes prime..............
for a:= 1 to length(L1) do
Cell(1,a):= L1(a);
end;
//...........................................


Am I misunderstanding you here?


RE: APP spreadsheet insert values - toshk - 12-14-2015 11:27 PM

[attachment=2957]
test values.....
gausss(M1,M3) to run;
type say vv to output a list...
this app has a lot of outputs , but i just want to tabular certain values in PFL sheet.
say busnumber in column A of PFL.
this


RE: APP spreadsheet insert values - jrozsas - 12-15-2015 12:04 PM

Toshk, for me it worked correctly, as shown in the figures.