8.1.26.5 Worksheet::ExportASCII

It is recommended that you switch to the originpro package. PyOrigin is primarily for users who need to work with Origin version prior to 2021.


Description

Export data as ASCII

Syntax

ExportASCII(name, Ctrl = WKS_EXPORT_ALL, cSep = '\t', R1 = 0, C1 = 0, R2 = -1, C2 = -1)

Parameters

name
Full path file name
Ctrl
Options defined in OC_Const.h : WKS_EXPORT_HEADING, etc.
cSep
Separator in the data file. The default value is "\t".
R1
First row in the data range to be included with the data file.
its default = 0.
C1
First column in the data range to be included with the data file.
its default = 0.
R2
Last row in the data range to be included with the data file. If < 0, indicate the last row in the worksheet.
its default = -1.
C2
Last column in the data range to be included with the data file. If < 0, indicate the last row in the worksheet.

its default = -1.

Return

On error, returns -1, otherwise returns the exported file size.

Examples

#Create Book1
import PyOrigin
PyOrigin.LT_execute('newbook name:=Book1')
Sheet=PyOrigin.WorksheetPages('Book1').Layers(0)
#Set data
pArr = [[x for x in range(5)] for x in range(2)] 
Sheet.SetData(pArr, 0,0)
#export ASCII
exp=Sheet.ExportASCII('D:\File.txt')
if exp!=-1:
    print('the file size is %d B' % exp)
else:
    print('Export failed')