Skip to content

Instantly share code, notes, and snippets.

View johnweldon's full-sized avatar

John Weldon johnweldon

View GitHub Profile
@johnweldon
johnweldon / read_xlsx.cs
Created October 9, 2012 20:44
Read Excel .xlsx file and return first worksheet as a DataTable
using System.Data;
using System.Data.OleDb;
using System.Diagnostics;
namespace JW4.DB.Util
{
public static class Excel
{
public static DataTable GetFirstWorksheetAsTable(string filename)
{
DROP TABLE tempA; CREATE TABLE tempA ( style_cd CHAR(3), id_cd VARCHAR(15) );
DROP TABLE tempB; CREATE TABLE tempB ( item_desc VARCHAR(50), item_num CHAR(4), style_cd CHAR(3), id_cd VARCHAR(15) );
INSERT INTO tempA
SELECT 'A', 123456
UNION SELECT 'A', 654321
UNION SELECT 'B', 321456
UNION SELECT 'A', 654123
UNION SELECT 'C', 424242;
#!/bin/bash
read -r -d '' AWK <<EOF
{
date=\$1;
refname=\$2;
subject=substr(\$3,1,72);
sha=\$4;
len=split(refname, ref, "/");