I want to Insert Images from the desktop(Local) in our Google Spreadsheet Cells using Script
Note: We can insert an image (from a computer) into the cell using: Insert -> Image -> Image in cell. And can I do the same using Apps Script?
I want to Insert Images from the desktop(Local) in our Google Spreadsheet Cells using Script
Note: We can insert an image (from a computer) into the cell using: Insert -> Image -> Image in cell. And can I do the same using Apps Script?
This is not possible.
Google Apps Script is a server-side run script which does not normally have access to your local machine to any degree.
As TheMaster pointed out, however, you can upload a file from your local machine with an HTML dialog. There is a great example on how to do this here, though the difference would be that you need to change the doGet(e)
function for some function that you can access on button click to show a modal:
function myFunction() {
var html = HtmlService.createHtmlOutputFromFile('dialog');
SpreadsheetApp.getUi() // Or DocumentApp or SlidesApp or FormApp.
.showModalDialog(html, 'dialog');
}
The issue arises however with inserting the image itself into a cell of a Google Sheet. While you can easily save an selected image in this way to Google Drive, as of time of writing this answer, there is no way to insert an image into a cell from Apps Script, more information on this you can read here.
There is an active feature request for this to be implemented on Google's Issue Tracker. If you are interested in having this implemented,then I urge you to follow this link and click the star in the top-left to indicate to Google that this is a feature of priority for their users.