sheetaki/public/index.html

98 lines
3.6 KiB
HTML
Raw Normal View History

2017-04-16 08:17:21 +00:00
<html>
<head>
<title>SheetJS Spreadsheet Conversion Service</title>
2018-10-20 22:22:24 +00:00
<link rel="icon" type="image/png" href="//sheetjs.com/logo.png"/>
2017-04-16 08:17:21 +00:00
</head>
<body>
<style> a { text-decoration: none } </style>
<pre>
<b><a href="http://sheetjs.com">SheetJS</a> Spreadsheet Conversion Service</b>
2020-08-09 05:04:31 +00:00
<b>Proxy:</b> send a request to /api/data to convert the spreadsheet at `url` to a simpler format
2017-04-16 08:17:21 +00:00
<b>parameters:</b>
- url=&lt;url&gt; the url to request
- N=&lt;idx&gt; the sheet index to use (-1 returns a list of sheet names in the workbook)
- t=&lt;type&gt; export type: "json" for json, "html" for html, default is CSV
<b>examples:</b>
</pre>
<pre id="examples"></pre>
<script>
2017-05-14 17:59:53 +00:00
var URL1 = "https://obamawhitehouse.archives.gov/sites/default/files/omb/budget/fy2014/assets/receipts.xls";
var URL2 = "https://www.ers.usda.gov/webdocs/DataFiles/50048/Feed%20Grains%20Yearbook%20Tables-All%20Years.xls?v=42839"
2017-04-16 08:17:21 +00:00
var URLS = [
2017-05-14 17:59:53 +00:00
["[CSV] ", {url:URL1}],
["[JSON]", {url:URL1, t:"json"}],
["[HTML]", {url:URL1, t:"html"}],
2017-04-16 08:17:21 +00:00
[],
2017-05-14 17:59:53 +00:00
["[LIST]", {url:URL2,N:-1}],
["[N=1] ", {url:URL2,N:1}],
2020-08-09 05:04:31 +00:00
// ["[N=2] ", {url:URL2,N:2}],
// ["[N=3] ", {url:URL2,N:3}],
2017-05-14 17:59:53 +00:00
["[N=4] ", {url:URL2,N:4}],
2020-08-09 05:04:31 +00:00
// ["[N=5] ", {url:URL2,N:5}],
// ["[N=6] ", {url:URL2,N:6}],
// ["[N=7] ", {url:URL2,N:7}],
2017-05-14 17:59:53 +00:00
["[N=8] ", {url:URL2,N:8}]
2017-04-16 08:17:21 +00:00
];
var parms = ["N", "t"];
for(var i = 0; i < URLS.length; ++i) {
if(URLS[i].length < 2) { document.getElementById("examples").innerHTML += (URLS[i][0]||"") + "\n"; continue; }
2020-08-03 01:06:11 +00:00
var path = '/api/data?url=' + URLS[i][1].url;
2017-04-16 08:17:21 +00:00
for(var j = 0; j < parms.length; ++j) if(URLS[i][1][parms[j]]) path += '&' + parms[j] + '=' + URLS[i][1][parms[j]];
document.getElementById("examples").innerHTML += '- ' + URLS[i][0] + ' <a href="' + path + '">' + path + '</a>\n';
}
</script>
<pre>
2020-08-09 05:04:31 +00:00
<b>Upload:</b> upload a file to /api/upload to convert the spreadsheet at `url` to a simpler format
<b>parameters:</b>
- N=&lt;idx&gt; the sheet index to use (-1 returns a list of sheet names in the workbook)
- t=&lt;type&gt; export type: "json" for json, "html" for html, default is CSV
<b>example:</b>
<form method="POST" action="api/upload" enctype="multipart/form-data"><input type="hidden" name="N" value="0">
<label for="file">Upload a file</label>
<input type="file" name="file" id="file">
<label for="t">Export type</label>
<select name="t" id="t">
<option value="csv" selected>CSV</option>
<option value="json">Array of arrays</option>
<option value="html">HTML TABLE</option>
</select>
<input type="submit" value="Click here to upload!">
</form>
<form method="POST" action="api/save" enctype="multipart/form-data"><input type="hidden" name="N" value="0">
<label for="file">Upload a file</label>
<input type="file" name="file" id="file">
<input type="submit" value="Click here to save!">
</form>
2020-08-09 05:04:31 +00:00
2017-04-16 08:17:21 +00:00
<b>This service is powered by <a href="http://sheetjs.com">SheetJS</a></b>
<b>Source Code:</b>
- <a href="https://github.com/SheetJS/sheetaki">Source code for this service</a>
2020-08-03 01:06:11 +00:00
- <a href="https://github.com/SheetJS/sheetjs">Source code for the SheetJS spreadsheet library</a>
2017-04-16 08:17:21 +00:00
</pre>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-36810333-1']);
_gaq.push(['_setDomainName', 'sheetjs.com']);
_gaq.push(['_setAllowLinker', true]);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</body>
</html>