Skip to content

Instantly share code, notes, and snippets.

View koltyakov's full-sized avatar

Andrew Koltyakov koltyakov

View GitHub Profile
@andrei-markeev
andrei-markeev / get-data-from-excel.js
Created November 15, 2016 10:09
Get data from Excel file stored in SharePoint using Excel REST API
var fileRelativeUrl = "Shared%20Documents/book1.xlsx";
var sheetName = "Sheet1";
var range = "A1|J45";
var url = _spPageContextInfo.webServerRelativeUrl.replace(/\/$/, '') + "/";
loadXMLDoc(url + "_vti_bin/ExcelRest.aspx/" + fileRelativeUrl + "/model/Ranges('" + sheetName + "!" + range + "')?$format=atom", function (text) {
var parser = new DOMParser();
var excelRestNS = 'http://schemas.microsoft.com/office/2008/07/excelservices/rest';
var xmlDoc = parser.parseFromString(text, "text/xml");
var rows = xmlDoc.getElementsByTagNameNS(excelRestNS, 'row');
@rjz
rjz / ngrok_hostname.sh
Created August 9, 2016 16:20
Get ngrok hostname from command line
#!/bin/sh
# ngrok's web interface is HTML, but configuration is bootstrapped as a JSON
# string. We can hack out the forwarded hostname by extracting the next
# `*.ngrok.io` string from the JSON
#
# Brittle as all get out--YMMV. If you're still reading, usage is:
#
# $ ./ngrok_hostname.sh <proto> <addr>
#