How to use the notation a1:a4 when referencing a spreadsheet from a python session

In textual spreadsheets, it is possible to use the notation a1:a4 to indicate all cells a1,a2,a3, and a4.
I can reference a single cell outside the spreadsheet (in a python session for example) using something like sheet-a1, is it possible to write something like sheet-a1:sheet-a4 to indicate all cells in the sheet from a1 to a4, if yes, then how?
image

Hi @Anas and welcome to the forum. I played a bit with spreadsheets and I have not even been able to get the reference to a cell to work outside a spreadsheet (as you say and as also the help files says). Would you mind sharing a brief document where you do that? To do that, you could open the document with a text editor, then copy its contents and paste them here in a code block (a paragraph whose first and last line consists in three backticks).

Said this—I think I found the definitions for the editing of the spreadsheets in progs/dynamic/calc-table.scm; in particular the function cell-ref-range seems the one that interprets the syntax for cell ranges. But I haven’t been yet able to understand how the code works :slight_smile:: maybe someone else is faster.

G.

Thanks for your response @pireddag
in order to reference the cell outside the sheet (in a python executable for example) I used the following combination:

\!\?sheet-a1

Here is a sample document:

<TeXmacs|2.1>

<style|generic>

<\body>
  <calc-table|sheet|<textual-table|<tformat|<table|<row|<cell|<cell-inert|a1|13>>|<cell|<cell-inert|b1|22>>|<cell|<cell-inert|c1|7>>>|<row|<cell|<cell-inert|a2|15>>|<cell|<cell-inert|b2|45>>|<cell|<cell-inert|c2|30>>>>>>>

  \;

  <script-output|python|default|print("a1+a2=
  %d"%(<calc-output|field1|<calc-ref|sheet-a1>|13>+<calc-output|field2|<calc-ref|sheet-a2>|15>))|a1+a2=
  28>
</body>

<\initial>
  <\collection>
    <associate|page-medium|paper>
    <associate|prog-scripts|python>
  </collection>
</initial>

Thanks for finding the function, I will try looking into it further