Skip to content

Commit

Permalink
Remove code from obsolete query feature
Browse files Browse the repository at this point in the history
  • Loading branch information
SusanRatiLane committed Jul 8, 2022
1 parent cada896 commit 340af7d
Showing 1 changed file with 0 additions and 103 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -346,109 +346,6 @@ public String GetRangeReference(int row1, int col1, int row2, int col2) {

/* Filters and Methods that Use Filters */

/**
* (<b>Note:</b> This requires that the Google Sheets document is shared such
* that <b>"Anyone with the link can view."</b>) Uses the Google Query
* Language, a language similar to SQL, to fetch data from publicly readable
* Google Sheets. For information on the syntax, see Google's Query Language
* Reference <a href='https://developers.google.com/chart/interactive/docs/querylanguage?hl=en'>
* here</a>.
*/
// @SimpleFunction(
// description="Uses the Google Query Language, a language similar to SQL, " +
// "to fetch data from publicly readable Google Sheets.")
// public void ReadWithQuery(final String sheetName, final String query) {
//
// if (spreadsheetID == "" || spreadsheetID == null) {
// ErrorOccurred("ReadWithQuery: " + "SpreadsheetID is empty.");
// return;
// }
//
// // Google Query API
// // https://developers.google.com/chart/interactive/docs/querylanguage?hl=en
//
//
//
//
// // Asynchronously conduct the HTTP Request
// AsynchUtil.runAsynchronously(new Runnable() {
// @Override
// public void run () {
// try {
// Sheets sheetsService = getSheetsService();
// int gridId = getSheetID(sheetsService, sheetName);
// if (gridId == -1) {
// ErrorOccurred("ReadWithQuery: sheetName not found");
// return;
// }
//
// // Converts the query into URL friendly encoding
// String encodedQuery = "";
// try {
// encodedQuery = URLEncoder.encode(query, "UTF-8");
// } catch (UnsupportedEncodingException e) {
// ErrorOccurred("ReadWithQuery: Error occurred encoding the query. UTF-8 is unsupported?");
// return;
// }
//
// // Formats the url from the template
// final String selectUrl = String.format("https://spreadsheet.google.com/tq?tqx=out:csv&key=%s&gid=%d&tq=%s",
// spreadsheetID, gridId, encodedQuery);
//
//// final String selectUrl = String.format(
//// "https://docs.google.com/spreadsheets/d/%s/export?format=csv&sheet=%s&tq=%s",
//// spreadsheetID, sheetName, encodedQuery);
// Log.d(LOG_TAG, "ReadWithQuery url: " + selectUrl);
//
// // HTTP Request
// URL url = new URL(selectUrl);
// HttpURLConnection connection = (HttpURLConnection) url.openConnection();
// connection.setRequestMethod("GET");
// if (accessToken != null) {
// String authHeaderValue = "Bearer " + accessToken;
// Log.d(LOG_TAG, "ReadWithQuery Auth Header: " + authHeaderValue);
// connection.setRequestProperty("Authorization", authHeaderValue);
// }
//
// // Parse the Result
// String responseContent = getResponseContent(connection);
// Log.d(LOG_TAG, "ReadWithQuery response content: " + responseContent);
// final YailList parsedCsv = CsvUtil.fromCsvTable(responseContent);
//
// // Dispatch the event.
// activity.runOnUiThread(new Runnable() {
// @Override
// public void run() {
// GotQueryResult(parsedCsv);
// }
// });
//
// // Catch Various Errors
// } catch (MalformedURLException e) {
// e.printStackTrace();
// ErrorOccurred("ReadWithQuery: MalformedURLException - " + e.getMessage());
// } catch (IOException e) {
// e.printStackTrace();
// ErrorOccurred("ReadWithQuery: IOException - " + e.getMessage());
// } catch (Exception e) {
// e.printStackTrace();
// ErrorOccurred("ReadWithQuery: Exception - " + e.getMessage());
// }
// }
// });
// }

/**
* The callbeck event for the {@link #ReadWithQuery()} block. The `response`
* is a list of rows, where each row satisfies the query.
*/
@SimpleEvent(
description="The callback event for the ReadWithQuery block. The " +
"`response` is a list of rows, where each row is a list of cell data.")
public void GotQueryResult (final List<List<String>> response) {
EventDispatcher.dispatchEvent(this, "GotQueryResult", response);
}

/**
* The callbeck event for the {@link #ReadWithQuery()} block. The `response`
* is a list of rows, where each row satisfies the query.
Expand Down

0 comments on commit 340af7d

Please sign in to comment.