Difference between revisions of "Spreadsheets in ACP1 - Old"

(Created page with "Spreadsheet functions that read from and write data to Excel in Analytica can also be used in ACP. This means that models in ACP can read from and write data to Excel spreadsh...")
 
m (Dpaine moved page Spreadsheets in ACP to Spreadsheets in ACP1 - Old without leaving a redirect: Excel no longer functional on our servers)
 
(44 intermediate revisions by 6 users not shown)
Line 1: Line 1:
Spreadsheet functions that read from and write data to Excel in Analytica can also be used in ACP. This means that models in ACP can read from and write data to Excel spreadsheets that have been uploaded to ACP. If the appropriate spreadsheet is not found, ACP can prompt the user to upload a spreadsheet. ACP can also allow the user to download spreadsheets straight from the model.
 
  
For more information about spreadsheet functions in Desktop Analytica, please see:
 
[[Functions To Read Excel Worksheets]]
 
[[Functions to Write Data to Excel Worksheets]]
 
  
=Reading Spreadsheets in ACP=
+
[[Analytica_Cloud_Platform#See_also|<<Back to Analytica Cloud Platform]]
 +
__TOC__
  
ACP will process the SpreadsheetOpen() function just like in Desktop Analytica, except the «showDialog» parameter will instead determines whether Analytica will prompt the user to upload a spreadsheet:
 
  
  SpreadsheetOpen(filename, ''showDialog'')
+
The functions to [[Read and Write Spreadsheets|open, read, write, and save spreadsheets]] work almost the same in [[Analytica Cloud Platform]] (ACP) as in Analytica on your own computer. They access spreadsheet files on the users ACP project directory. ACP also offers the option of uploading a spreadsheet from the end user's computer to the ACP directory on the web server, and downloading from the ACP directory back to the computer.
  
If a spreadsheet with the appropriate ''filename'' is present in the ACP folder, then ACP will read the spreadsheet as in ACP. If there is no spreadsheet with the appropriate filename, then if the «showDialog» is set to ''True'' ACP will ask the user if they would like to upload a spreadsheet to read when any node utilizing the SpreadsheetOpen() function is evaluated. This spreadsheet is then uploaded to ACP with its existing filename in the same directory as the model. Like in Desktop Analytica, the user does not have to select a spreadsheet with the same filename as the «filename» parameter but after the session is ended Analytica will not remember any filenames aside from what is used in the «filename» parameter.
+
== Upload and download spreadsheets in the ACP Models view ==
  
Unlike Desktop Analytica, ACP will only prompt a user to upload a spreadsheet once per session. If you would like Analytica to prompt a user multiple times, the definition of the SpreadsheetOpen() variable must be reset. For example, if Va1 calls SpreadsheetOpen(), you can create a duplicate of Va1 called Va2 and use a button script to set the definition of Va1 as the definition Va2 like so:
+
A simple way to upload and download spreadsheets is from the ACP Models view that lists the model (and spreadsheet) files in your ACP Project. You can upload or download Analytica spreadsheets just as you an upload and download model files. To upload a file, you simply click the '''Upload''' button on bottom left. To download a file, you click the radio button in the '''Select''' column for that file, and click the '''Download''' button. (Reviewers may upload Spreadsheets, and may download spreadsheets which they uploaded. Otherwise you need to have '''Author''' or '''Manager''' access to the project to use the '''Upload''' and '''Download''' buttons.)
  
Definition of Va1: SpreadsheetOpen('example.xls',True)
+
:*In ACP, Press '''Upload'''
Definition of Va2: SpreadsheetOpen('example.xls',True)
 
 
OnClick for Reset Button
 
Definition of Va1 := Definition of Va2;
 
  
After pressing the Reset button, the user will be able to upload a new spreadsheet when Va1 is evaluated regardless if a spreadsheet has already been uploaded.
+
:[[File:Spreadsheet upload 01.PNG]]
  
=Downloading Spreadsheets in ACP=
+
:*ACP recognizes both Analytica model and Excel spreadsheet files.
  
To download a spreadsheet in ACP, simply add "download_spreadsheet" to the CloudPlayerStyles Attribute of a button. When the button is pressed in ACP, a pop-up will open that redirects the user to download the open spreadsheet file.
+
:[[File:Spreadsheet upload 02.PNG]]
 +
 
 +
:*Upload both the Model file and the Spreadsheet files to ACP. You can download files to try it out here: [[Media:Functions for Reading Excel Worksheets.ana|Reading Excel Worksheets.ana]] and [[media:SOLVSAMP.XLS|SolvSamp.xls]].
 +
:*Both files can now be seen in the Model listing
 +
 
 +
:[[File:Spreadsheet upload 03.PNG]]
 +
 
 +
:*Now you can play the model which uses the spreadsheet functions as long as the spreadsheet is present in the model list. You can't open the spreadsheet in ACP directly or send it by Email invite. The '''Email Invite''' button is disabled when the spreadsheet's radio button is selected}.
 +
 
 +
:[[File:Spreadsheet upload 04.PNG]]
 +
 
 +
== Upload and download spreadsheets from an ACP model ==
 +
It's often more convenient for end users to be able to upload spreadsheets from their computer and download them again directly from an ACP model.  In ACP,  [[SpreadsheetOpen]](filename) tries to find a file matching filename in the ACP Project directory. If it doesn't it shows the user a Windows file browser prompt to find a file on the user's own computer with that filename as the default. After the user selects a file, it uploads it to the ACP directory and opens it as a spreadsheet.  You can force it always to open a file browser dialog by specifying SpreadsheetOpen(filename, ShowDialog: True). 
 +
 
 +
Downloading a spreadsheet is slightly less obvious, since [[SpreadsheetSave]](workbook) doesn't have a way to open a dialog to download a file (yet). Instead, create a button with title "Download spreadsheet", say. Add <code>Download_spreadsheet</code> to its '''AcpStyles''' attribute.  When the end user clicks the button, it offers to download the last spreadsheet uploaded in this session, if any. When the end user clicks the button, it opens a file browser dialog to select a directory to accept the file. Or you can specify a named spreadsheet by adding <code>download_spreadsheet: filename.xlsx</code> to its '''AcpStyles''' attribute. This will download the file named <code>filename.xlsx</code> in the same ACP directory as the model. {In this case, if the file is not present then ACP will give an error}.
 +
 
 +
Similarly, you can upload a spreadsheet, without using Excel, by creating a button with the flag <code>Upload_spreadsheet</code> in its'  '''AcpStyles''' attribute. When the user clicks the button, they are prompted to upload a spreadsheet file. This takes place after the onclick completes (for the case where an onclick has more than one line). There is currently no way to name the spreadsheet. However, to retrieve the filename, you can save the spreadsheet to the definition of a variable:  In the button CPS attribute if you have the following:
 +
 
 +
<code>upload_spreadsheet<br/>
 +
Upload_filename_variable: Var_x</code>
 +
 
 +
After uploading the file, ACP will write the filename (e.g. "ssFile.xlsx" note current does not include full path) to the definition of Var_x
 +
 
 +
===CSV files===
 +
CSV files are supported by ACP.
 +
 
 +
*You need to have the [[Analytica_Libraries_and_Templates#Flat_File_Library|Flat File library]] in your model to access the functions to read/write/parse these files.
 +
*To access csv file data in ACP you upload the CSV file as detailed above for a spreadsheet file.
 +
 
 +
== ReadTextFile ==
 +
[[ReadTextFile]] basically works the same in ACP as [[SpreadsheetOpen]] does while playing a model. For a variable which calls this function, ACP will show a file upload dialog which will allow the user to upload the text document and use the data in models played in that ACP account.
 +
 
 +
== Example ACP Model for reading and writing spreadsheets ==
 +
Here's an example to illustrate these methods:
 +
*[[Media:SpreadsheetExampleACP.zip| Download Example Model & Spreadsheet]]
 +
 
 +
:[[File:SpreadsheetExamplePicACP.jpg|450px]]
 +
 
 +
In the example model, the '''Read Spreadsheet''' button prompts a user to upload a workbook and copies the contents of that workbook into the <code>Saved Data</code> node. The '''Download Spreadsheet with Results''' button copies the results of the <code>Gallons per Year</code> node into the original workbook file, and saves that as a new workbook file named <code>saved_example</code>.
 +
 
 +
==Reading Spreadsheets==
 +
 
 +
ACP will actually upload the selected spreadsheet to the same ACP directory the model is in. If there is an existing spreadsheet with the same name in the same directory, ACP will ask if the user would like to overwrite the existing file, or rename the existing spreadsheet.
 +
 
 +
Note that you cannot save a spreadsheet if it is locked by Excel. So if you decide you want to rename or overwrite a file after accessing it in the same session, you will need to cut  the link to the spreadsheet first, as described below: [[Spreadsheets_in_ACP#Opening_Multiple_Spreadsheets_per_Session|Multiple Spreadsheets in One Session]].
 +
 
 +
To read a spreadsheet in Analytica, you must first call [[SpreadsheetOpen]](), which returns a link to the workbook.  You can use [[SpreadsheetRange]]() to determine what to import into Analytica from the opened workbook.
 +
 
 +
In the example model, the definition of <code>Spreadsheet_Workbook</code> is:
 +
:<code>SpreadsheetOpen('example.xlsx', ShowDialog: True)</code>
 +
 
 +
It looks for a file named <code>example.xlsx</code> in the same directory as the model. Parameter <code>ShowDialog: True</code> means it will prompt you to select a file, and set the name, even if file <code>example.xlsx</code> already exists. For more details, see [[Functions To Read Excel Worksheets#SpreadsheetOpen(filename, showDialog) | SpreadsheetOpen()]].
 +
 
 +
The definition of <code>Spreadsheet_Range</code> is:
 +
:<code>SpreadsheetRange(Spreadsheet_Workbook, 'Raw Data!', howToIndex: 12)</code>
 +
 
 +
When evaluated, it looks for the sheet <code>Raw Data</code> in <code>Spreadsheet_Workbook</code>. It imports all of the data contained in that sheet into <code>Spreadsheet_Range</code>. It creates implicit indexes  <code>Row</code> and <code>Column</code> from the first row and first column of the data, and uses those to index the data. For details on other parameter options, see [[Functions To Read Excel Worksheets#SpreadsheetRange(workbook, range, colIndex, rowIndex, howToIndex, sheet, what) | SpreadsheetRange()]].
 +
 
 +
===Opening Multiple Spreadsheets per Session===
 +
The example model prompts the user to select a spreadsheet every time the '''Read Spreadsheet''' button is pressed, regardless of whether a spreadsheet has already been selected in that session.
 +
 
 +
Generally speaking, when a node contains [[SpreadsheetOpen]](), even if the «showDialog» parameter is set to <code>true</code> it only prompts the user to select a spreadsheet until a spreadsheet has been selected. Once a spreadsheet has been selected, ACP will not ask again. If the user would like to open more than one spreadsheet for the same variable in the same session, the link between ACP and the opened spreadsheet must be cut. This can be done by changing the definition of <code>Spreadsheet Open</code>.
 +
 
 +
In the example model, this is accomplished in the OnClick of the '''Read Spreadsheet''' button as follows:
 +
 
 +
:<code>Spreadsheet_Workbook := 0;</code>
 +
:<code>DEFINITION OF Spreadsheet_Workbook := "SpreadsheetOpen('example.xlsx', True)";</code>
 +
 
 +
Both lines must be used in order to reset the definition -- if only the second line of code was used, because it is exactly the same as the existing definition ACP will not reset the workbook link and will continue to use the existing workbook. The first line cuts the workbook link and the second line resets the definition to a call to [[SpreadsheetOpen]]().
 +
 
 +
===Saving Spreadsheet Data to a New Variable===
 +
It is best practice to copy data from a spreadsheet into a new variable so that the data can be manipulated and the model can run even if the spreadsheet is not available. In the example model, this is done in the OnClick code of the '''Read Spreadsheet''' button as follows.
 +
 
 +
:<code>Car_Type := CopyIndex(Spreadsheet_Range.Row);</code>
 +
:<code>Car_Info := CopyIndex(Spreadsheet_Range.Column);</code>
 +
:<code>Saved_Data := Spreadsheet_Range[@.Row = @Car_Type, @.Column = @Car_Info];</code>
 +
 
 +
The first two lines copy the implicit indexes <code>Row</code> and <code>Column</code> into existing Index nodes <code>Car Type</code> and <code>Car Info</code>, respectively. The last line copies the data from <code>Spreadsheet Range</code> into the <code>Saved Data</code> variable, and reindexes the data from the implicit indexes to the new global indexes.
 +
 
 +
==Writing to Spreadsheets==
 +
Once you have opened a workbook in ACP, you can write data to the workbook using [[SpreadsheetSetCell]](), [[SpreadsheetSetRange]](), and [[SpreadsheetSetInfo]]().
 +
 
 +
<tip title="Note"> If any changes are made to a workbook from ACP, [[SpreadsheetSave]]() must be called for those changes to be saved. In order to write to spreadsheets from a model, the '''Acp Styles''' attribute must have <code>use_async_calls: yes</code> { Now the default so should not be necessary } included in the top level of the model.</tip>
 +
 
 +
In the example model, this is done in the OnClick of the '''Download Spreadsheet with Results''' button:
 +
 
 +
:<code>SpreadsheetSetCell(Spreadsheet_Workbook, "Gallons per Year", 1, @Car_Type, Car_Type);</code>
 +
:<code>SpreadsheetSetCell(Spreadsheet_Workbook, "Gallons per Year", 2, @Car_Type, Gallons_per_Year);</code>
 +
:<code>SpreadsheetSave(Spreadsheet_Workbook, 'saved_example');</code>
 +
 
 +
The first two lines write the contents of the <code>Car Type</code> index to the first column in the sheet named <code>Gallons per Year</code> and the variable <code>Gallons per Year</code> to the second column in the sheet named <code>Gallons per Year</code>. For more details on different parameter options, see [[Functions to Write Data to Excel Worksheets#SpreadsheetSetCell( workbook, sheet, col, row, value ) | SpreadsheetSetCell()]].
 +
 
 +
The last line saves the updated spreadsheet into a new file named <code>saved_example</code>. This file is not saved in the ACP directory for future sessions, but can be downloaded during the current session. If instead new filename was specified, ACP would save over the existing file, which can be accessed in future attempts. For more details on different parameter options, see [[Functions to Write Data to Excel Worksheets#SpreadsheetSave( workbook, filename ) | SpreadsheetSave()]].
 +
 
 +
If no workbook is already open and the '''Download Spreadsheet with Results''' button, ACP first prompts the user to select a workbook before completing the calculations. However, it will only execute the OnClick of the '''Download Spreadsheet with Results''' button if a workbook is opened this way and ignore any OnClick code in the '''Read Spreadsheet''' button (i.e., it will not copy the data from the opened spreadsheet to Saved Data and therefore will be saving the existing results to the spreadsheet, not results from the newly uploaded spreadsheet).
 +
 
 +
<tip title="Tip">You can find out the filename of the spreadsheet opened using Analytica's built-in [[SpreadsheetInfo]] function with the second parameter set to 'Name', and use [[JoinText]]() to add it to "download_spreadsheet".</tip>
 +
 
 +
In the example model, downloading is achieved by placing the following in the '''AcpStyles''' attribute of the '''Download Spreadsheet with Results''' button:
 +
 
 +
:<code>download_spreadsheet:saved_example.xlsx</code>
 +
 
 +
This causes the button to trigger a download of the file named <code>saved_example.xlsx</code>.
 +
 
 +
<tip title="Note">AcpStyles simply add flags to nodes or add something to what is returned, so ACP will evaluate the OnClick of a button first (i.e. data can be written to a spreadsheet in the same button that will cause the download of the spreadsheet).</tip>
 +
 
 +
==See Also==
 +
* [[Media:SpreadsheetExampleACP.zip| Example model and spreadsheet]]
 +
* [[Read and Write Spreadsheets | Read and Write Spreadsheets in Desktop Analytica]]
 +
* [[Excel spreadsheets read and write]]
 +
* [[Functions To Read Excel Worksheets]]
 +
* [[Functions to Write Data to Excel Worksheets]]
 +
* [[Excel to Analytica Mappings]]
 +
* [[Excel to Analytica Translation]]
 +
* [[Excel Functions from ADE]]
 +
* [[Analytica Cloud Platform]]

Latest revision as of 23:16, 9 February 2023


<<Back to Analytica Cloud Platform


The functions to open, read, write, and save spreadsheets work almost the same in Analytica Cloud Platform (ACP) as in Analytica on your own computer. They access spreadsheet files on the users ACP project directory. ACP also offers the option of uploading a spreadsheet from the end user's computer to the ACP directory on the web server, and downloading from the ACP directory back to the computer.

Upload and download spreadsheets in the ACP Models view

A simple way to upload and download spreadsheets is from the ACP Models view that lists the model (and spreadsheet) files in your ACP Project. You can upload or download Analytica spreadsheets just as you an upload and download model files. To upload a file, you simply click the Upload button on bottom left. To download a file, you click the radio button in the Select column for that file, and click the Download button. (Reviewers may upload Spreadsheets, and may download spreadsheets which they uploaded. Otherwise you need to have Author or Manager access to the project to use the Upload and Download buttons.)

  • In ACP, Press Upload
Spreadsheet upload 01.PNG
  • ACP recognizes both Analytica model and Excel spreadsheet files.
Spreadsheet upload 02.PNG
Spreadsheet upload 03.PNG
  • Now you can play the model which uses the spreadsheet functions as long as the spreadsheet is present in the model list. You can't open the spreadsheet in ACP directly or send it by Email invite. The Email Invite button is disabled when the spreadsheet's radio button is selected}.
Spreadsheet upload 04.PNG

Upload and download spreadsheets from an ACP model

It's often more convenient for end users to be able to upload spreadsheets from their computer and download them again directly from an ACP model. In ACP, SpreadsheetOpen(filename) tries to find a file matching filename in the ACP Project directory. If it doesn't it shows the user a Windows file browser prompt to find a file on the user's own computer with that filename as the default. After the user selects a file, it uploads it to the ACP directory and opens it as a spreadsheet. You can force it always to open a file browser dialog by specifying SpreadsheetOpen(filename, ShowDialog: True).

Downloading a spreadsheet is slightly less obvious, since SpreadsheetSave(workbook) doesn't have a way to open a dialog to download a file (yet). Instead, create a button with title "Download spreadsheet", say. Add Download_spreadsheet to its AcpStyles attribute. When the end user clicks the button, it offers to download the last spreadsheet uploaded in this session, if any. When the end user clicks the button, it opens a file browser dialog to select a directory to accept the file. Or you can specify a named spreadsheet by adding download_spreadsheet: filename.xlsx to its AcpStyles attribute. This will download the file named filename.xlsx in the same ACP directory as the model. {In this case, if the file is not present then ACP will give an error}.

Similarly, you can upload a spreadsheet, without using Excel, by creating a button with the flag Upload_spreadsheet in its' AcpStyles attribute. When the user clicks the button, they are prompted to upload a spreadsheet file. This takes place after the onclick completes (for the case where an onclick has more than one line). There is currently no way to name the spreadsheet. However, to retrieve the filename, you can save the spreadsheet to the definition of a variable: In the button CPS attribute if you have the following:

upload_spreadsheet
Upload_filename_variable: Var_x

After uploading the file, ACP will write the filename (e.g. "ssFile.xlsx" note current does not include full path) to the definition of Var_x

CSV files

CSV files are supported by ACP.

  • You need to have the Flat File library in your model to access the functions to read/write/parse these files.
  • To access csv file data in ACP you upload the CSV file as detailed above for a spreadsheet file.

ReadTextFile

ReadTextFile basically works the same in ACP as SpreadsheetOpen does while playing a model. For a variable which calls this function, ACP will show a file upload dialog which will allow the user to upload the text document and use the data in models played in that ACP account.

Example ACP Model for reading and writing spreadsheets

Here's an example to illustrate these methods:

SpreadsheetExamplePicACP.jpg

In the example model, the Read Spreadsheet button prompts a user to upload a workbook and copies the contents of that workbook into the Saved Data node. The Download Spreadsheet with Results button copies the results of the Gallons per Year node into the original workbook file, and saves that as a new workbook file named saved_example.

Reading Spreadsheets

ACP will actually upload the selected spreadsheet to the same ACP directory the model is in. If there is an existing spreadsheet with the same name in the same directory, ACP will ask if the user would like to overwrite the existing file, or rename the existing spreadsheet.

Note that you cannot save a spreadsheet if it is locked by Excel. So if you decide you want to rename or overwrite a file after accessing it in the same session, you will need to cut the link to the spreadsheet first, as described below: Multiple Spreadsheets in One Session.

To read a spreadsheet in Analytica, you must first call SpreadsheetOpen(), which returns a link to the workbook. You can use SpreadsheetRange() to determine what to import into Analytica from the opened workbook.

In the example model, the definition of Spreadsheet_Workbook is:

SpreadsheetOpen('example.xlsx', ShowDialog: True)

It looks for a file named example.xlsx in the same directory as the model. Parameter ShowDialog: True means it will prompt you to select a file, and set the name, even if file example.xlsx already exists. For more details, see SpreadsheetOpen().

The definition of Spreadsheet_Range is:

SpreadsheetRange(Spreadsheet_Workbook, 'Raw Data!', howToIndex: 12)

When evaluated, it looks for the sheet Raw Data in Spreadsheet_Workbook. It imports all of the data contained in that sheet into Spreadsheet_Range. It creates implicit indexes Row and Column from the first row and first column of the data, and uses those to index the data. For details on other parameter options, see SpreadsheetRange().

Opening Multiple Spreadsheets per Session

The example model prompts the user to select a spreadsheet every time the Read Spreadsheet button is pressed, regardless of whether a spreadsheet has already been selected in that session.

Generally speaking, when a node contains SpreadsheetOpen(), even if the «showDialog» parameter is set to true it only prompts the user to select a spreadsheet until a spreadsheet has been selected. Once a spreadsheet has been selected, ACP will not ask again. If the user would like to open more than one spreadsheet for the same variable in the same session, the link between ACP and the opened spreadsheet must be cut. This can be done by changing the definition of Spreadsheet Open.

In the example model, this is accomplished in the OnClick of the Read Spreadsheet button as follows:

Spreadsheet_Workbook := 0;
DEFINITION OF Spreadsheet_Workbook := "SpreadsheetOpen('example.xlsx', True)";

Both lines must be used in order to reset the definition -- if only the second line of code was used, because it is exactly the same as the existing definition ACP will not reset the workbook link and will continue to use the existing workbook. The first line cuts the workbook link and the second line resets the definition to a call to SpreadsheetOpen().

Saving Spreadsheet Data to a New Variable

It is best practice to copy data from a spreadsheet into a new variable so that the data can be manipulated and the model can run even if the spreadsheet is not available. In the example model, this is done in the OnClick code of the Read Spreadsheet button as follows.

Car_Type := CopyIndex(Spreadsheet_Range.Row);
Car_Info := CopyIndex(Spreadsheet_Range.Column);
Saved_Data := Spreadsheet_Range[@.Row = @Car_Type, @.Column = @Car_Info];

The first two lines copy the implicit indexes Row and Column into existing Index nodes Car Type and Car Info, respectively. The last line copies the data from Spreadsheet Range into the Saved Data variable, and reindexes the data from the implicit indexes to the new global indexes.

Writing to Spreadsheets

Once you have opened a workbook in ACP, you can write data to the workbook using SpreadsheetSetCell(), SpreadsheetSetRange(), and SpreadsheetSetInfo().

Note
If any changes are made to a workbook from ACP, SpreadsheetSave() must be called for those changes to be saved. In order to write to spreadsheets from a model, the Acp Styles attribute must have use_async_calls: yes { Now the default so should not be necessary } included in the top level of the model.

In the example model, this is done in the OnClick of the Download Spreadsheet with Results button:

SpreadsheetSetCell(Spreadsheet_Workbook, "Gallons per Year", 1, @Car_Type, Car_Type);
SpreadsheetSetCell(Spreadsheet_Workbook, "Gallons per Year", 2, @Car_Type, Gallons_per_Year);
SpreadsheetSave(Spreadsheet_Workbook, 'saved_example');

The first two lines write the contents of the Car Type index to the first column in the sheet named Gallons per Year and the variable Gallons per Year to the second column in the sheet named Gallons per Year. For more details on different parameter options, see SpreadsheetSetCell().

The last line saves the updated spreadsheet into a new file named saved_example. This file is not saved in the ACP directory for future sessions, but can be downloaded during the current session. If instead new filename was specified, ACP would save over the existing file, which can be accessed in future attempts. For more details on different parameter options, see SpreadsheetSave().

If no workbook is already open and the Download Spreadsheet with Results button, ACP first prompts the user to select a workbook before completing the calculations. However, it will only execute the OnClick of the Download Spreadsheet with Results button if a workbook is opened this way and ignore any OnClick code in the Read Spreadsheet button (i.e., it will not copy the data from the opened spreadsheet to Saved Data and therefore will be saving the existing results to the spreadsheet, not results from the newly uploaded spreadsheet).

Tip
You can find out the filename of the spreadsheet opened using Analytica's built-in SpreadsheetInfo function with the second parameter set to 'Name', and use JoinText() to add it to "download_spreadsheet".

In the example model, downloading is achieved by placing the following in the AcpStyles attribute of the Download Spreadsheet with Results button:

download_spreadsheet:saved_example.xlsx

This causes the button to trigger a download of the file named saved_example.xlsx.

Note
AcpStyles simply add flags to nodes or add something to what is returned, so ACP will evaluate the OnClick of a button first (i.e. data can be written to a spreadsheet in the same button that will cause the download of the spreadsheet).

See Also

Comments


You are not allowed to post comments.