I have a google sheet connected to my MySQL database with a Google script. I'm able to retrieve all the text data I want instead of the blob stored in the database. Here is the php code:
$insert = $conn->query("INSERT into images (image) VALUES ('$base64Img')");
I only left one field to make it clear
The blob column in the table is set to "LONGBLOB". How can I view my BLOB as an image in my google sheet?
Here is what I tried :
function readFromTable() {
var conn = Jdbc.getConnection(url, username, password);
var stmt = conn.createStatement();
stmt.setMaxRows(1000);
var results = stmt.executeQuery('SELECT image FROM images');
var numCols = results.getMetaData().getColumnCount();
var spreadsheet = SpreadsheetApp.getActive();
var sheet = spreadsheet.getSheetByName('Sheet1');
var arr=[];
while (results.next()) {
var arr = [];
for (var col = 0; col < numCols; col++) {
arr.push(results.getBlob(col + 1));
}
sheet.appendRow(arr);
}
results.close();
stmt.close();
}
I don't get any error message but on my sheet it prints : JdbcBlob in the cell instead of the actual image. I would like to put the image into a cell of my google sheet