When I save a google sheet as xlsx i don't see the images I have in sheets using =image() - google-sheets

When I save a google sheet as xlsx I don't see the images I have in sheets using =image()
The exported file does not contain the images I see on the Google sheet. I have tried to copy paste the images in google sheet as value, then export to xlsx but still don't see images in the xlsx file that was downloaded.
Can someone help, please.

EDIT (following OP's comment)
Can we have any script for that
You need neither a script nor a formula for that.
You only need "to save your images using Insert image from the insert menu."
IMAGE is a Google specific function and canNOT be viewed by .xlsx
As well as any of the Google specific functions
Your alternative is to save your images by using Insert image from the insert menu.

Related

Query from xlsx google sheet to new sheet

The original working sheet is .xlsx and I would like to query that file into my personal working sheet. However the importrange doesn't seem to work and it returns 'You don't have permission to access that sheet'. Can anyone share how to fix this.
I.e the original working file belongs to another (not mine) and I'm not allowed to do any change especially change the file from .xlsx to gsheet file.

Download embeded google sheets

as I'm not a web developer by any means, this is me just asking a question for that I have not found a solution for.
I have a google sheet with multiple pages/sheets within it. the file is embeded in an iframe inside a webpage and I pulled the url and can open it directly using the url. the following link is just an example as I can't share the actual link since I am not allowed to:
https://docs.google.com/spreadsheets/d/e/{key}/pubhtml?widget=true&headers=false
I have tried this:
https://spreadsheets.google.com/feeds/download/spreadsheets/Export?key={key}
and is not working I get an error:
Sorry, unable to open the file at present.
Please check the address and try again.
the file is not meant for anyone to download nor share. Furthremore, since it is continuosely manually updated by author and I need to keep track of updates, taking screenshots is not efficient since the file is too big.
is there any way I can download the actual sheet to my device (so I can compare file updates over the long run)
Thank you.
I believe your goal as follows.
You want to download a Google Spreadsheet.
You are the owner of Google Spreadsheet.
The Spreadsheet is published as the Web publish. So the URL of Spreadsheet is https://docs.google.com/spreadsheets/d/e/2PACX-1vTl9bcwMSjoxYj406evzJefFodkVEUlV2KIq34Y5V8BFWJygAFrPSA7L5d89TASDUjkPG4b2SfN2rpe/pubhtml?widget=true&headers=false.
Issue and workaround:
Unfortunately, the Google Spreadsheet cannot be directly downloaded as the Google Spreadsheet. It seems that this is the current specification. In this case, it is required to export the Google Spreadsheet as other mimeType. For example, it's XLSX format, PDF format and CSV format. But the URL of https://docs.google.com/spreadsheets/d/e/2PACX-1vTl9bcwMSjoxYj406evzJefFodkVEUlV2KIq34Y5V8BFWJygAFrPSA7L5d89TASDUjkPG4b2SfN2rpe/pubhtml?widget=true&headers=false cannot directly export. So, in this answer, as a workaround, I would like to propose to use the URL for exporting Google Spreadsheet as other mimeType.
When your URL is used, the URL for exporting is as follows.
Modified url:
https://docs.google.com/spreadsheets/d/e/2PACX-1vTl9bcwMSjoxYj406evzJefFodkVEUlV2KIq34Y5V8BFWJygAFrPSA7L5d89TASDUjkPG4b2SfN2rpe/pub?output=xlsx
In this case, when you access to above URL using browser, your Spreadsheet can be exported as a XLSX file.
When output=xlsx is modified to output=pdf and output=csv, you can export as a PDF file and a CSV file, respectively.
When you want to export the specific sheetm please use the sheet ID like gid=0. The URL is as follows.
https://docs.google.com/spreadsheets/d/e/2PACX-1vTl9bcwMSjoxYj406evzJefFodkVEUlV2KIq34Y5V8BFWJygAFrPSA7L5d89TASDUjkPG4b2SfN2rpe/pub?output=xlsx&gid=0
Note:
When you want to make users downloading the Spreadsheet, you can add the tag a as follows.
Download

When saving PDF (manually and also by script), some cells with values appear empty (Google Sheets)

Updating the question, the problem I could see was not with the script but directly with the spreadsheet.
I tried to save the PDF manually and some images still not showing up.
In Spreadsheet File Online:
PDF Save Manually:
The curious fact is that until yesterday this was not happening.
Link to Spreadsheet:
https://docs.google.com/spreadsheets/d/1tg3p3q0gPKWPoeoxbFTE5tJgrU5dQnGa6ok2LcsXNns/edit#gid=45463727&range=A1
Obs.: I removed all other pages from the spreadsheet, also removed the formulas and left this page to share, with values only. Still the error still persists when I create a pdf
Try calling SpreadsheetApp.flush(); on the line before you create the PDF. This will force an update of all calculations before creating the PDF.
If this doesn't work then you'll need to post your script and some samples so we can try to reproduce the problem.

Using IMPORTRANGE to import from Excel file in Google Drive

To import an entire sheet of data from another spreadsheet using IMPORTRANGE I'd do something like this:
=importrange("google-drive-id-for-spreadsheet","A:AR")
This works fine for a Google Sheets spreadsheet source, but if the source file is an Excel spreadsheet, I get a #Ref! error in the cell and the hover comment is:
Error Spreadsheet cannot be found.
I'm presuming this is because IMPORTRANGE doesn't work with Excel files, so how can I achieve the same thing?
I don't mind working with scripts but would prefer a formula solution if possible.
Edit: This happens whether I use the full URL or just the spreadsheet key and if I use the sheet name with the range or not. I've tried several files and it always works with the Google Sheets files and never works with Excel files.
Something occurred to me about the ownership and location of these files. Somebody else is the owner of the spreadsheet that I want the IMPORTRANGE formula in. I have full edit permissions. The folder that the spreadsheet resides in is owned by the same guy, it has been shared with me and I have added it to my Drive. In a subfolder of this folder is where the source files are. I am the owner of the subfolder and the source files within, both Excel and Google Sheets files.
Could this setup have anything to do with the results I'm getting?
Edit: I've had the ownership of the folders (all the way up the hierarchy) and relevant files transferred to me and it's still doing the same thing.
This is clearly only a work around and not an answer, but I had to do something so that I could move on. The only way I could get what I wanted is to code a convert to .gsheet format first and point imortrange to that new sheet. Might help someone else get their project pointing in a working direction until this can be answered.
There are there way to fix this problem:
Convert the Excel spreadsheet to a Google spreadsheet. You can then use the importrange() function to import the data from the converted file.
Export the Excel spreadsheet to a CSV file first, then you can use a different function called the importdata() function to import that data into a Google spreadsheet.
Using Add-on: "Sheetgo"
You should watch this video:
How to automatically import Excel Data to Google Sheets?

XML SDK 2.0 - Images - Excel file

With the use of the Open XML SDK 2.0, I did preformed the Reflected Code of an Excel file.
Along with other things, the Excel file has some images in some of the cells. When I run the code that was generated, the file show the images just fine.
What I need to do is to programatically inject images in place of the
images that are there now. The thing is, I cannot find where the images are at in the code that was generated. How can I figure this out? Also what is the easiest way to replace those images with new ones programmatically?
You may want to take a look at a similar question about inserting images into Excel files with OpenXML SDK: C# & OpenXML: Insert an image into an excel document.
Basically, those files are created as separate document parts. The answer I linked to should show You how to insert a new image into a document, however, in order to substitute existing images with your custom ones, you could probably just modify the binary data of appropriate ImagePart (and some other associated properties).
If You need some help with the code performing this task, let me know.

Resources