In google sheets is there any way to use importrange but maintain formatting? (no paid add-on) - google-apps-script

In google sheets is there any way to use importrange but maintain formatting? Aware of SheetsGo but don't want a paid solution. Not referring to conditional formatting specifically, more row colors, etc.

You can't import formatting directly. But there is a simple solution, which I use all the time. For the sake of explanation, let's say your source spreadsheet is called "Source" and your destination spreadsheet is called "Destination." From there:
1.) Open Source and go to the sheet you want to have imported into Destination.
2.) Right-click on the tab that shows the sheet name. Choose Copy to > Existing spreadsheet. Use the search tool to find Destination. Click on that sheet.
3.) Open the Destination spreadsheet.The Source sheet will appear there, with the name "Copy of [sheet name]" and with all formatting from Source. Change the sheet name as you like. Then just click the upper-leftmost empty rectangle (between A and 1) to select the entire sheet and hit the Delete key. This will leave just your formatting. From here, you can now enter your IMPORTRANGE formula(s), and they'll populate without changing the formatting.
This might sound like a lot. But in actuality, it only takes 20 seconds to do.

Related

Named Ranges have sheet name stuck in them when sheets are copied from certain spreadsheet

I'm merging the different versions of a D&D template and noticed that copying sheets from a certain one of them to an existing/new spreadsheet causes the Named Range names to contain the sheet name, but in some kinda ghost form (e.g.: if trying to edit the Named Range, the name shows normally). Any clue what's causing this, how to fix it, or how to get around it?
Though I manually fixed them all by deleting and re-creating back-to-back, that version of the template might get updated in the future and I'll have to consider repeating this process.
"copy of WildShape" spreadsheet
image - "copy of WildShape" sheet's
Named Ranges
see "WildShape" sheet of merged version

Recording any copies made of a google sheet

I would like to create a Google sheet that records any copies that have been made of another Google Sheet even when the user creates a copy by putting 'copy' into the URL (https://docs.google.com/spreadsheets/d/"spreadsheet-ID"/copy).
I have found a solution on the post: Track number of copies made from a google spreadsheet but this doesn't record copies made when changing the URL as the above example.
I would like to know the whole URL of the sheet preferably but just the Spreadhseet ID would still be enough for me.
Has anyone got any ideas how I can record all this data onto a spreadsheet please?
Basically you won't have access to see who is copying your sheet if you use the built-in Make Copy.
What you could do is integrate part of the question you have provided, while disabling the built-in sharing method. So the only way to copy your sheet could be through a custom function you can control and register every time it executes.

Navigation in published Google Sheets

I need to publish a report I have in Google Sheets, but since the report is very big, with many sheets and tables, I have hyperlinks set up for easy navigation, that take you to ranges in other sheets.
When I publish the sheet, the hyperlinks stop working (they take you to the first sheet in a new browser tab). I also tried with a script to change the pages with a button, but the button is not clickable in the published page.
Thanks for any tips you might have.
EDIT:
I've prepared a test sheet to see if I find a solution for this. This is a link with permissions to edit:
https://docs.google.com/spreadsheets/d/1ZGw_6WjrkcNKdFvS8gIG46gEMfMuw7ex86SR9C7qXTU/edit?usp=sharing
And this would be the published version:
https://docs.google.com/spreadsheets/d/e/2PACX-1vTa8JDNMzwdvk87kCvbjJXYgK2RGiKy503eJn6eEjxbyU8oIsuvuKTNXCM6yRP16KXrnD9yvLV3J488/pubhtml
This actually works in Excel, I can embed the report and the hyperlinks still work fine, but I have everything else in Google Sheets, so I'd like to find a workaround.
You need to use proper query parameters. The sheet id, gid must be set to navigate properly. You cannot use rangeid. You can however use range.
/pubhtml?chrome=false&gid=[YOUR_SHEET_ID]&range=A1:B1
You can get your sheet id by visiting your sheet(tab) in your spreadsheet (edit version) and inspecting the url.
Your published sheet probably retains the original #gid (which is Google's sheet ID used for local links). This will fail because it is linked to a Spreadsheet that is inaccessible to the new report. Please check if this is the case (you'll see in the links you've created). I can understand that you won't want to share the original reports but you can set up a small test Spreadsheet with a few linked sheet ranges to test the process - please share that.

Hide formula bar in google sheets

I want to achieve the following:
I do not want other users of the sheet to access the formula bar for certain cells/sheets of the spreadsheet
I want to block them from accessing the script editor (do not want to show the code) used for this sheet
I do not want other users of the sheet to access the formula bar for certain cells/sheets of the spreadsheet
This is not possible.
You could publish your spreadsheet but this will not allow to edit any content, or to use Google Forms, but this will allow respondents only to submit data, not to view the result of calculations.
To securely hide the formulas they should be in another spreadsheet. You could use IMPORTRANGE or a script to import/export the calculations result. Bear in mind that IMPORTRANGE isn't recalculated immediately and that scripts could be slower than built-in functions.
An alternative is to create a web app that makes the calculations and call it from a custom function.
I want to block them from accessing the script editor (do not want to show the code) used for this sheet
It's not possible to block editors to access the Script editor. For details see
Scripts Bound to Google Sheets, Docs, or Forms. To prevent that viewers get access to the code, block the spreadsheet for making a copy. For details see Change your sharing settings
You can set permissions per cell:
- Click the cell
- Left-mouse click or Ctrl+click -> menu 'Protect range'
- Click 'Set Permissions' in sidebar
- Select Only You
Now the content is still visible.
There is a work-around for this, which is quite complicated.
- Create another sheet, called Formulas.
- Protect this sheet the same way above.
- In your main sheet you can refer to formulas in the other sheet: =Formulas!B1
- Now you can write the formula in this cell B1 in sheet Formulas
=Sheet1!B1+Sheet1!C1-Sheet1!D1 (where Sheet1 is the name of the first sheet)
- Now hide the Formulas sheet

How do I copy a script from one spreadsheet to another spreadsheet?

I need to copy an existing script, which I did not write, into my existing spreadsheet. The script is called "SaveBack", and can be found here: https://docs.google.com/a/levelgroup.com/spreadsheet/ccc?key=0Agcb8bUVVOOodHhoV3BrRGZ6UEdSYnVLSEk3bllxRnc#gid=1.
My existing spreadsheet is too complex (it has many other spreadsheets that link to it) to copy all of its sheets into the spreadsheet that contains the script. I have already copied the SaveBack editor sheet template sheet to my main spreadsheet, but I can't figure out how to copy the SaveBack script that goes along with it into my spreadsheet.
Can anyone help? Thanks!
Open the save back script, select the script text, copy it, go to your sheet, create a new script (blank template), paste the script you copied into your new script, name is SaveBack (assuming it's a project), check the triggers on the original script and make sure your triggers match, and you should be good to go. You will have to change any sheet, document, or other string ID's to match your files' Id's, but that isn't too bad.
I do this sort of thing all of the time when I'm migrating things back and forth between my work and personal account. You could also create a copy of the other person's spreadsheet that you linked above, and it will move the script over with it. Then you can go to the script and get the project key to use it as library in your own scripts. Since you're using your copy as the library, you don't have to worry about someone else changing the script and breaking your functionality.