ExcelScript.Query interface
Represents a Power Query query.
Remarks
Examples
/**
* This script logs information about all the Power Query queries in the workbook.
*/
function main(workbook: ExcelScript.Workbook) {
// Get all the Power Query queries in the workbook.
const queries = workbook.getQueries();
// For each query, log the date it was last refreshed.
queries.forEach((query: ExcelScript.Query) => {
console.log(`Query ${query.getName()} - last refreshed ${query.getRefreshDate()}`);
});
}
Methods
get |
Gets the query error message from when the query was last refreshed. |
get |
Gets the query loaded to object type. |
get |
Specifies if the query loaded to the data model. |
get |
Gets the name of the query. Query names cannot contain periods or quotation marks. |
get |
Gets the date and time when the query was last refreshed. |
get |
Gets the number of rows that were loaded when the query was last refreshed. If last refresh has errors the value will be -1. |
Method Details
getError()
Gets the query error message from when the query was last refreshed.
getError(): QueryError;
Returns
getLoadedTo()
getLoadedToDataModel()
Specifies if the query loaded to the data model.
getLoadedToDataModel(): boolean;
Returns
boolean
getName()
Gets the name of the query. Query names cannot contain periods or quotation marks.
getName(): string;
Returns
string
getRefreshDate()
Gets the date and time when the query was last refreshed.
getRefreshDate(): Date;
Returns
Date
getRowsLoadedCount()
Gets the number of rows that were loaded when the query was last refreshed. If last refresh has errors the value will be -1.
getRowsLoadedCount(): number;
Returns
number
Office Scripts