-
-
Notifications
You must be signed in to change notification settings - Fork 42
write
Julian Halliwell edited this page Dec 23, 2015
·
16 revisions
Write a spreadsheet object to a file.
write( workbook, filepath[, overwrite, password, algorithm ] )
##Required arguments
-
workbookspreadsheet object -
filepathstring: the absolute path of the file to be written.
##Optional arguments
-
overwriteboolean default=false: whether to overwrite an existing file -
passwordstring: if supplied the file will be encrypted and require the password to be opened. - Password-protection only works with XML format (.xlsx) spreadsheets.
-
algorithmstring default="agile": algorithm/mode to use when encrypting a file. Possible values are agile, standard or binaryRC4 - The available algorithms are not universally supported by spreadsheet software. You may find encrypted files cannot be opened depending on which algorithm you use to encrypt and which program you use to open the file.
- Note that binaryRC4 is apparently regarded as not very secure.
##Examples
data = QueryNew( "First,Last","VarChar,VarChar",[ [ "Susi","Sorglos" ],[ "Frumpo","McNugget" ] ] );
spreadsheet = New spreadsheet();
workbook = spreadsheet.workbookFromQuery( data );
path = "C:/temp/test.xls";
spreadsheet.write( workbook,path );
###Write a password protected file
data = QueryNew( "First,Last","VarChar,VarChar",[ [ "Susi","Sorglos" ],[ "Frumpo","McNugget" ] ] );
spreadsheet = New spreadsheet();
workbook = spreadsheet.workbookFromQuery( data=data,xmlFormat=true);
path = "C:/temp/test.xlsx";
spreadsheet.write( workbook,path,"secret" );