KAPOW

Welcome to the Kapow forum. Here you can get help, use your skills to help others and enjoy hanging out in the company of other Kapow Robot Developers.


Saving downloaded csv or excel files

Share

cmorris

Posts : 11
Points : 178
Join date : 2017-05-17

Saving downloaded csv or excel files

Post by cmorris on Wed Aug 02, 2017 5:16 pm

Hi,

Does anyone know if it's possible to save a downloaded file (csv or excel) WITHOUT having to extract into variables?  If this is indeed possible, I'd be interested to know which version of Kapow allows this.

Thanks in advance!
avatar
jking

Posts : 26
Points : 1367
Join date : 2014-03-01
Location : USA

Re: Saving downloaded csv or excel files

Post by jking on Wed Aug 02, 2017 8:22 pm

Yes, you can save a downloaded file (cvs, excel, pdf, xml, etc.).  Every version of Kapow that I have used (since 9.2.5) has supported the write file step.

After you have exported the file into your variable add a Write File step.  This step will either write a new file or it will append to an existing file. 

Step Properties

File Name 
The name of the file. The name must be an absolute file name, including the drive name, if any, and the directory path to the file.  For example: C:\Folder\myspreadsheet.xlsx
File Content 
The contents to write to the file.  Normally I choose the variable I extracted the downloaded file into (Excel, pdf, etc.).
File Encoding 
If the contents to write to the file is text, this property specifies the character encoding to use for encoding the text as bytes. 
Append to File 
Specifies whether a new file should always be created (overwriting any existing file with the same name), or whether the contents should be appended to the file if it already exists. 
Create Directories 
Specifies whether to create the necessary directories on the file path before creating a new file. If not selected, then the action will fail if any directory on the path does not exist. 
Execute in Design Mode 
If this is enabled, the action will be executed even in Design Mode inside Design Studio. If this is disabled, the action will do nothing when you navigate the robot in Design Mode. 

A CSV can be written in two ways: Either write the file one line at a time with Write File, using an Add To CSV data converter to create each line. Alternatively, build up the desired file contents one line at a time in a global variable (again with the aid of the Add To CSV data converter) and use Write File in the end (that is, in an additional branch) to write the file in one piece. 

In order to modify the global variable that holds the file contents, use an Assign Variable action that takes its input from a Get Variable data converter pointing to the variable itself. This is then followed by the Add To CSV data converter.

cmorris

Posts : 11
Points : 178
Join date : 2017-05-17

Re: Saving downloaded csv or excel files

Post by cmorris on Wed Aug 02, 2017 9:10 pm

Thanks for the reply, much appreciated!  However, it sounds like you would still need to include an 'extract to variable' step, before writing the file.  I was looking for a way to avoid this, and just write the downloaded file.  Is this possible?
avatar
jking

Posts : 26
Points : 1367
Join date : 2014-03-01
Location : USA

Re: Saving downloaded csv or excel files

Post by jking on Thu Aug 03, 2017 4:06 am

I do not know a way to do this directly without 1st extracting into a variable prior to writing the file.
Perhaps another user knows of a way.

    Current date/time is Fri Oct 20, 2017 11:04 pm