LaTeX tables in Google Drive
Here are two nice ways of generating LaTeX code for tables in Google Drive. I haven't tested them very much, but they seem to do a great job:
Using http://www.tablesgenerator.com/. You just copy-and-paste your table from GDrive to the grid shown in the website, you can easily change the style of the table.
Using the following GDrive script created by Dave Rim.
function latexify() {
var range = SpreadsheetApp.getActiveRange();
var numRows = range.getNumRows();
var numCols = range.getNumColumns();
var values = range.getValues();
var cs = new Array(numCols);
var strRows = "";
for(var k = 0; k < numCols; k++){
cs[k] = 'c';
}
strRows = "\\begin{table}\n";
strRows += "\\centering\n";
strRows += "\\begin{tabular}";
strRows += "{|" + cs.join("|") + "|}\n"
strRows += "\\hline\n";
for (var i = 0; i <= numRows - 1; i++) {
var row = values[i];
for (var j = 0; j <= numCols - 1; j++){
var cell = row[j];
strRows = strRows + cell;
if(j < numCols-1)
strRows = strRows + " & ";
}
strRows += "\\\\ \n\\hline\n";
}
strRows += "\\hline";
strRows += "\\end{tabular}\n";
strRows += "\\label{table:table}\n";
strRows += "\\caption{\\small{}} \n";
strRows += "\\end{table}\n";
Logger.log(strRows);
};
To use it:
Enjoy!