Skip to content

Book

Extends

  • Book

Properties

payload

payload: Book;

The underlying payload data for this resource

Inherited from

Bkper.Book.payload

Methods

addCollaborator()

addCollaborator(email, permission): void;

Adds a collaborator to the Book.

Parameters

ParameterType
emailstring
permissionPermission

Returns

void

Inherited from

Bkper.Book.addCollaborator

audit()

audit(): void;

Trigger Balances Audit async process.

Returns

void

Inherited from

Bkper.Book.audit

batchCheckTransactions()

batchCheckTransactions(transactions): void;

Batch check [[Transactions]] on the Book.

Parameters

ParameterType
transactionsTransaction[]

Returns

void

Inherited from

Bkper.Book.batchCheckTransactions

batchCreateAccounts()

batchCreateAccounts(accounts): Account[];

Create [[Accounts]] on the Book, in batch.

Parameters

ParameterType
accountsAccount[]

Returns

Account[]

The Accounts created

Inherited from

Bkper.Book.batchCreateAccounts

batchCreateGroups()

batchCreateGroups(groups): Group[];

Create [[Groups]] on the Book, in batch.

Parameters

ParameterType
groupsGroup[]

Returns

Group[]

The Groups created

Inherited from

Bkper.Book.batchCreateGroups

batchCreateTransactions()

batchCreateTransactions(transactions): Transaction[];

Batch create [[Transactions]] on the Book.

Parameters

ParameterType
transactionsTransaction[]

Returns

Transaction[]

The Transactions created

Inherited from

Bkper.Book.batchCreateTransactions

batchTrashTransactions()

batchTrashTransactions(transactions, trashChecked?): void;

Batch trash [[Transactions]] on the Book.

Parameters

ParameterType
transactionsTransaction[]
trashChecked?boolean

Returns

void

Inherited from

Bkper.Book.batchTrashTransactions

batchUncheckTransactions()

batchUncheckTransactions(transactions): void;

Batch uncheck [[Transactions]] on the Book.

Parameters

ParameterType
transactionsTransaction[]

Returns

void

Inherited from

Bkper.Book.batchUncheckTransactions

batchUpdateTransactions()

batchUpdateTransactions(transactions, updateChecked?): void;

Batch update [[Transactions]] on the Book.

Parameters

ParameterType
transactionsTransaction[]
updateChecked?boolean

Returns

void

Inherited from

Bkper.Book.batchUpdateTransactions

continueTransactionIterator()

continueTransactionIterator(query, continuationToken): TransactionIterator;

Resumes a transaction iteration using a continuation token from a previous iterator.

Parameters

ParameterType
querystring
continuationTokenstring

Returns

TransactionIterator

a collection of transactions that remained in a previous iterator when the continuation token was generated

Inherited from

Bkper.Book.continueTransactionIterator

countTransactions()

countTransactions(query?): number;

Retrieve the number of transactions based on a query.

Parameters

ParameterType
query?string

Returns

number

The number of matching Transactions

Inherited from

Bkper.Book.countTransactions

createAccount()

createAccount(
name,
group?,
description?): Account;

Create an [[Account]] in this book.

The type of account will be determined by the type of others Accounts in same group.

If not specified, the type ASSET (permanent=true/credit=false) will be set.

If all other accounts in same group is in another group, the account will also be added to the other group.

Parameters

ParameterType
namestring
group?string
description?string

Returns

Account

The created Account object

Inherited from

Bkper.Book.createAccount

createAccounts()

createAccounts(accounts): Account[];

Create [[Accounts]] on the Book, in batch.

The first column of the matrix will be used as the [[Account]] name.

The other columns will be used to find a matching [[AccountType]].

Names matching existent accounts will be skipped.

Parameters

ParameterType
accountsstring[][]

Returns

Account[]

Inherited from

Bkper.Book.createAccounts

createAccountsDataTable()

createAccountsDataTable(group?): AccountsDataTableBuilder;

Create a [[AccountsDataTableBuilder]], to build two dimensional Array representations of [[Accounts]] dataset.

Parameters

ParameterType
group?string

Returns

AccountsDataTableBuilder

Accounts data table builder.

Example:

var book = BkperApp.getBook("agtzfmJrcGVyLWhyZHITCxIGTGVkZ2VyGICAgPXjx7oKDA");
var accountsDataTable = book.createAccountsDataTable().build();
// Or filter by group
var filteredDataTable = book.createAccountsDataTable("Revenue").build();

Inherited from

Bkper.Book.createAccountsDataTable

createBalancesDataTable()

createBalancesDataTable(query): BalancesDataTableBuilder;

Create a [[BalancesDataTableBuilder]] based on a query, to create two dimensional Array representation of balances of [[Account]] or [[Group]]

See Query Guide to learn more

Parameters

ParameterType
querystring

Returns

BalancesDataTableBuilder

The balances data table builder

Example:

var book = BkperApp.getBook("agtzfmJrcGVyLWhyZHITCxIGTGVkZ2VyGICAgPXjx7oKDA");
var balancesDataTable = book.createBalancesDataTable("account:'Credit card' after:7/2018 before:8/2018").build();

Inherited from

Bkper.Book.createBalancesDataTable

createGroups()

createGroups(groups): Group[];

Create [[Groups]] on the Book, in batch.

Parameters

ParameterType
groupsstring[]

Returns

Group[]

Inherited from

Bkper.Book.createGroups

createGroupsDataTable()

createGroupsDataTable(): GroupsDataTableBuilder;

Create a [[GroupsDataTableBuilder]], to build two dimensional Array representations of [[Groups]] dataset.

Returns

GroupsDataTableBuilder

Groups data table builder.

Example:

var book = BkperApp.getBook("agtzfmJrcGVyLWhyZHITCxIGTGVkZ2VyGICAgPXjx7oKDA");
var groupsDataTable = book.createGroupsDataTable().build();

Inherited from

Bkper.Book.createGroupsDataTable

createTransactionsDataTable()

createTransactionsDataTable(query?): TransactionsDataTableBuilder;

Create a [[TransactionsDataTableBuilder]] based on a query, to build two dimensional Array representations of [[Transactions]] dataset.

See Query Guide to learn more

Parameters

ParameterType
query?string

Returns

TransactionsDataTableBuilder

Transactions data table builder.

Example:

var book = BkperApp.getBook("agtzfmJrcGVyLWhyZHITCxIGTGVkZ2VyGICAgPXjx7oKDA");
var transactionsDataTable = book.createTransactionsDataTable("account:'Bank Account' before:1/2019").build();

Inherited from

Bkper.Book.createTransactionsDataTable

deleteProperty()

deleteProperty(key): this;

Parameters

ParameterType
keystring

Returns

this

Inherited from

Bkper.Book.deleteProperty

formatAmount()

formatAmount(amount): string;

Formats an amount according to [[DecimalSeparator]] and fraction digits of the Book.

Parameters

ParameterType
amountAmount

Returns

string

The value formated

Inherited from

Bkper.Book.formatAmount

formatDate()

formatDate(date, timeZone?): string;

Formats a date according to date pattern of the Book.

Parameters

ParameterType
dateDate
timeZone?string

Returns

string

The date formated

Inherited from

Bkper.Book.formatDate

formatValue()

formatValue(value): string;

Formats a value according to [[DecimalSeparator]] and fraction digits of the Book.

Parameters

ParameterType
valueAmount

Returns

string

The value formated

Inherited from

Bkper.Book.formatValue

getAccount()

getAccount(idOrName): Account;

Gets an [[Account]] object

Parameters

ParameterType
idOrNamestring

Returns

Account

The matching Account object

Inherited from

Bkper.Book.getAccount

getAccounts()

getAccounts(group?): Account[];

Parameters

ParameterType
group?string

Returns

Account[]

All [[Accounts]] of this Book, or filtered by group if specified

Inherited from

Bkper.Book.getAccounts

getApps()

getApps(): App[];

Retrieve installed [[Apps]] for this Book

Returns

App[]

The Apps objects

Inherited from

Bkper.Book.getApps

getBacklog()

getBacklog(): Backlog;

Retrieve the pending events [[Backlog]] for this Book

Returns

Backlog

The Backlog object

Inherited from

Bkper.Book.getBacklog

getBalancesReport()

getBalancesReport(query): BalancesReport;

Create a [[BalancesReport]] based on query

Parameters

ParameterType
querystring

Returns

BalancesReport

The balances report

Example:

var book = BkperApp.getBook("agtzfmJrcGVyLWhyZHITCxIGTGVkZ2VyGICAgPXjx7oKDA");
var balancesReport = book.getBalancesReport("group:'Equity' after:7/2018 before:8/2018");
var accountBalance = balancesReport.getBalancesContainer("Bank Account").getCumulativeBalance();

Inherited from

Bkper.Book.getBalancesReport

getClosingDate()

getClosingDate(): string;

Returns

string

The closing date of the Book in ISO format yyyy-MM-dd

Inherited from

Bkper.Book.getClosingDate

getCollection()

getCollection(): Collection;

Returns

Collection

The collection of this book

Inherited from

Bkper.Book.getCollection

getDatePattern()

getDatePattern(): string;

Returns

string

The date pattern of the Book. Current: dd/MM/yyyy | MM/dd/yyyy | yyyy/MM/dd

Inherited from

Bkper.Book.getDatePattern

getDecimalSeparator()

getDecimalSeparator(): DecimalSeparator;

Returns

DecimalSeparator

The decimal separator of the Book

Inherited from

Bkper.Book.getDecimalSeparator

getEvents()

getEvents(
afterDate?,
beforeDate?,
onError?,
resource?): EventIterator;

Get Book events based on search parameters.

Parameters

ParameterType
afterDate?string
beforeDate?string
onError?boolean
resource?Account | Group | Transaction

Returns

EventIterator

The Events result as an iterator.

Inherited from

Bkper.Book.getEvents

getFile()

getFile(id): File;

Retrieve a [[File]] by id

Parameters

ParameterType
idstring

Returns

File

The matching File object

Inherited from

Bkper.Book.getFile

getFractionDigits()

getFractionDigits(): number;

Returns

number

The number of fraction digits (decimal places) supported by this Book

Inherited from

Bkper.Book.getFractionDigits

getGroup()

getGroup(idOrName): Group;

Gets a [[Group]] object

Parameters

ParameterType
idOrNamestring

Returns

Group

The matching Group object

Inherited from

Bkper.Book.getGroup

getGroups()

getGroups(): Group[];

Returns

Group[]

All [[Groups]] of this Book

Inherited from

Bkper.Book.getGroups

getId()

getId(): string;

Same as bookId param

Returns

string

The id of this Book

Inherited from

Bkper.Book.getId

getLastUpdateMs()

getLastUpdateMs(): number;

Returns

number

The last update date of the book, in in milliseconds

Inherited from

Bkper.Book.getLastUpdateMs

getLockDate()

getLockDate(): string;

Returns

string

The lock date of the Book in ISO format yyyy-MM-dd

Inherited from

Bkper.Book.getLockDate

getName()

getName(): string;

Returns

string

The name of this Book

Inherited from

Bkper.Book.getName

getOwnerName()

getOwnerName(): string;

Returns

string

The name of the owner of the Book

Inherited from

Bkper.Book.getOwnerName

getPeriodStartMonth()

getPeriodStartMonth(): Month;

Returns

Month

The start month when YEAR period set

Inherited from

Bkper.Book.getPeriodStartMonth

getPermission()

getPermission(): Permission;

Returns

Permission

The permission for the current user

Inherited from

Bkper.Book.getPermission

getProperties()

getProperties(): object;

Returns

object

Inherited from

Bkper.Book.getProperties

getProperty()

getProperty(...keys): string;

Parameters

ParameterType
keysstring[]

Returns

string

Inherited from

Bkper.Book.getProperty

getPropertyKeys()

getPropertyKeys(): string[];

Returns

string[]

Inherited from

Bkper.Book.getPropertyKeys

getSavedQueries()

getSavedQueries(): object[];

Returns

object[]

All saved queries from this book

Inherited from

Bkper.Book.getSavedQueries

getTimeZone()

getTimeZone(): string;

Returns

string

The time zone of the Book

Inherited from

Bkper.Book.getTimeZone

getTimeZoneOffset()

getTimeZoneOffset(): number;

Returns

number

The time zone offset of the book, in minutes

Inherited from

Bkper.Book.getTimeZoneOffset

getTotalTransactions()

getTotalTransactions(): number;

Returns

number

The total number of posted transactions

Inherited from

Bkper.Book.getTotalTransactions

getTotalTransactionsCurrentMonth()

getTotalTransactionsCurrentMonth(): number;

Returns

number

The total number of posted transactions on current month

Inherited from

Bkper.Book.getTotalTransactionsCurrentMonth

getTotalTransactionsCurrentYear()

getTotalTransactionsCurrentYear(): number;

Returns

number

The total number of posted transactions on current year

Inherited from

Bkper.Book.getTotalTransactionsCurrentYear

getTransaction()

getTransaction(id): Transaction;

Retrieve a [[Transaction]] by id

Parameters

ParameterType
idstring

Returns

Transaction

The matching Transaction object

Inherited from

Bkper.Book.getTransaction

getTransactions()

getTransactions(query?): TransactionIterator;

Get Book transactions based on a query.

See Query Guide to learn more

Parameters

ParameterType
query?string

Returns

TransactionIterator

The Transactions result as an iterator.

Example:

var book = BkperApp.getBook("agtzfmJrcGVyLWhyZHITCxIGTGVkZ2VyGICAgIDggqALDA");
var transactions = book.getTransactions("account:CreditCard after:28/01/2013 before:29/01/2013");
while (transactions.hasNext()) {
var transaction = transactions.next();
Logger.log(transaction.getDescription());
}

Inherited from

Bkper.Book.getTransactions

getVisibleProperties()

getVisibleProperties(): object;

Returns

object

Inherited from

Bkper.Book.getVisibleProperties

json()

json(): Book;

Gets an immutable copy of the JSON payload for this resource.

Returns

Book

An immutable copy of the json payload

Inherited from

Bkper.Book.json

newAccount()

newAccount(): Account;

Instantiate a new [[Account]]

Returns

Account

The new Account, for chainning.

Example:

var book = BkperApp.getBook("agtzfmJrcGVyLWhyZHITCxIGTGVkZ2VyGICAgIDggqALDA");
book.newAccount()
.setName('Some New Account')
.setType('INCOMING')
.addGroup('Revenue').addGroup('Salary')
.setProperties({prop_a: 'A', prop_b: 'B'})
.create();

Inherited from

Bkper.Book.newAccount

newFile()

newFile(): File;

Instantiate a new [[File]]

Returns

File

The new File, for chainning.

Example:

var book = BkperApp.getBook("agtzfmJrcGVyLWhyZHITCxIGTGVkZ2VyGICAgIDggqALDA");
book.newFile()
.setBlob(UrlFetchApp.fetch('https://bkper.com/images/index/integrations4.png').getBlob())
.create();

Inherited from

Bkper.Book.newFile

newGroup()

newGroup(): Group;

Instantiate a new [[Group]]

Returns

Group

The new Group, for chainning.

Example:

var book = BkperApp.getBook("agtzfmJrcGVyLWhyZHITCxIGTGVkZ2VyGICAgIDggqALDA");
book.newGroup()
.setName('Some New Group')
.setProperty('key', 'value')
.create();

Inherited from

Bkper.Book.newGroup

newTransaction()

newTransaction(): Transaction;

Instantiate a new [[Transaction]]

Returns

Transaction

The new Transaction, for chainning.

Example:

var book = BkperApp.getBook("agtzfmJrcGVyLWhyZHITCxIGTGVkZ2VyGICAgIDggqALDA");
book.newTransaction()
.setDate('2013-01-25')
.setDescription("Filling tank of my truck")
.from('Credit Card')
.to('Gas')
.setAmount(126.50)
.create();

Inherited from

Bkper.Book.newTransaction

parseAmount()

parseAmount(value): Amount;

Parse an amount string according to [[DecimalSeparator]] and fraction digits of the Book.

Parameters

ParameterType
valuestring

Returns

Amount

The Amount parsed

Inherited from

Bkper.Book.parseAmount

parseDate()

parseDate(date): Date;

Parse a date string according to date pattern and timezone of the Book.

Also parse ISO yyyy-mm-dd format.

Parameters

ParameterType
datestring

Returns

Date

The date parsed

Inherited from

Bkper.Book.parseDate

parseValue()

parseValue(value): Amount;

Parse a value string according to [[DecimalSeparator]] and fraction digits of the Book.

Parameters

ParameterType
valuestring

Returns

Amount

Inherited from

Bkper.Book.parseValue

record()

record(transactions, timeZone?): void;

Record [[Transactions]] on the Book.

The text is usually amount and description, but it can also can contain an informed Date in full format (dd/mm/yyyy - mm/dd/yyyy).

Example:

book.record("#gas 63.23");

Parameters

ParameterType
transactionsstring | any[] | any[][]
timeZone?string

Returns

void

Inherited from

Bkper.Book.record

removeCollaborator()

removeCollaborator(email): void;

Removes a collaborator from the Book.

Parameters

ParameterType
emailstring

Returns

void

Inherited from

Bkper.Book.removeCollaborator

round()

round(amount): Amount;

Rounds an amount according to the number of fraction digits of the Book

Parameters

ParameterType
amountAmount

Returns

Amount

The Amount rounded

Inherited from

Bkper.Book.round

setClosingDate()

setClosingDate(closingDate): Book;

Sets the closing date of the Book in ISO format yyyy-MM-dd.

Parameters

ParameterType
closingDatestring | null

Returns

Book

This Book, for chainning.

Inherited from

Bkper.Book.setClosingDate

setDatePattern()

setDatePattern(datePattern): Book;

Sets the date pattern of the Book. Current: dd/MM/yyyy | MM/dd/yyyy | yyyy/MM/dd

Parameters

ParameterType
datePatternstring

Returns

Book

This Book, for chainning.

Inherited from

Bkper.Book.setDatePattern

setDecimalSeparator()

setDecimalSeparator(decimalSeparator): Book;

Sets the decimal separator of the Book

Parameters

ParameterType
decimalSeparatorDecimalSeparator

Returns

Book

This Book, for chainning.

Inherited from

Bkper.Book.setDecimalSeparator

setFractionDigits()

setFractionDigits(fractionDigits): Book;

Sets the number of fraction digits (decimal places) supported by this Book

Parameters

ParameterType
fractionDigitsnumber

Returns

Book

This Book, for chainning.

Inherited from

Bkper.Book.setFractionDigits

setLockDate()

setLockDate(lockDate): Book;

Sets the lock date of the Book in ISO format yyyy-MM-dd.

Parameters

ParameterType
lockDatestring | null

Returns

Book

This Book, for chainning.

Inherited from

Bkper.Book.setLockDate

setName()

setName(name): Book;

Sets the name of the Book.

Parameters

ParameterType
namestring

Returns

Book

This Book, for chainning.

Inherited from

Bkper.Book.setName

setPeriodStartMonth()

setPeriodStartMonth(month): Book;

Sets the start month when YEAR period set

Parameters

ParameterType
monthMonth

Returns

Book

This Book, for chainning.

Inherited from

Bkper.Book.setPeriodStartMonth

setProperties()

setProperties(properties): this;

Parameters

ParameterType
properties{ [key: string]: string; }

Returns

this

Inherited from

Bkper.Book.setProperties

setProperty()

setProperty(key, value): this;

Parameters

ParameterType
keystring
valuestring

Returns

this

Inherited from

Bkper.Book.setProperty

setTimeZone()

setTimeZone(timeZone): Book;

Sets the time zone of the Book

Parameters

ParameterType
timeZonestring

Returns

Book

This Book, for chainning.

Inherited from

Bkper.Book.setTimeZone

setVisibleProperties()

setVisibleProperties(properties): this;

Parameters

ParameterType
properties{ [key: string]: string; }

Returns

this

Inherited from

Bkper.Book.setVisibleProperties

setVisibleProperty()

setVisibleProperty(key, value): this;

Parameters

ParameterType
keystring
valuestring | null

Returns

this

Inherited from

Bkper.Book.setVisibleProperty

update()

update(): Book;

Perform update Book, applying pending changes.

Returns

Book

This Book, for chainning.

Inherited from

Bkper.Book.update