Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make a copy of a spreadsheet and rename spreadsheet #169

Closed
g4spow opened this issue Jan 26, 2018 · 24 comments
Closed

Make a copy of a spreadsheet and rename spreadsheet #169

g4spow opened this issue Jan 26, 2018 · 24 comments
Labels

Comments

@g4spow
Copy link

g4spow commented Jan 26, 2018

I need to make a complete copy of a spreadsheet(not worksheet) and also rename it to it's ID.
ie. Like you would do using "File-Make a Cop" and also rename "stockdata" to "12xxlLWhrhnTMP7yDxVLaA_amWdhTFIFazyo9N7gG9_I"

Is this possible in pygsheets?

@nithinmurali
Copy link
Owner

you can't copy a spreadsheet using pygsheets, you will have to use the drive api for that. Though you can use the drive_service object in pyghseets client. As for renaming its as simple as ss.title= ss.id

Please use stack-overflow for usage related question with pyghseets tag

@tehfink
Copy link

tehfink commented Mar 14, 2018

It would be nice if the method create(self, title, parent_id=None) took a template parameter, which would basically just copy an existing document. What do you think?

@nithinmurali
Copy link
Owner

That could be useful.

@mateolan
Copy link

+1 For copying a template spreadsheet into a new spreadsheet.

@tehfink
Copy link

tehfink commented Jun 5, 2018

@nithinmurali Thanks!

@ashwinramdas12
Copy link

ashwinramdas12 commented Apr 3, 2020

@nithinmurali I have tried the create function and specified a spefici spreadsheet for the template, but it creates a completely blank spreadsheet instead of making a copy of the template.

@EricPHassey
Copy link

@nithinmurali I have tried the create function and specified a spefici spreadsheet for the template, but it creates a completely blank spreadsheet instead of making a copy of the template.

I'm also having this problem now. I thought I got it to work earlier, so not sure what happened or where the bug may be.

nithinmurali added a commit that referenced this issue May 1, 2020
@nithinmurali
Copy link
Owner

fixed this

@ashwinramdas12
Copy link

ashwinramdas12 commented May 4, 2020

@nithinmurali Still does not work for me. Do I need to update pygsheets? I have version 2.0.3.1 downloaded. Still creating the blank sheet even though I'm specifying a template. My code is:

template = pyg_gc.open("testing")
pyg_gc.create("test spreadsheet7", folder="1XnjlUh9n2u2XJfBJ3XP6qw8oRUCCjQ74", template=template)

Is my syntax wrong?

@nithinmurali
Copy link
Owner

nithinmurali commented May 4, 2020

@ashwinramdas12 Is it not released and is still in staging. you can install it via

pip install https://github.com/nithinmurali/pygsheets/archive/staging.zip

@ashwinramdas12
Copy link

@nithinmurali Just tried it with the new install. Still getting a blank sheet instead of a copy of the template.

@nithinmurali
Copy link
Owner

nithinmurali commented May 4, 2020

@ashwinramdas12 that's strange. i just tested it and is working fine. Are you sure you are installing from staging branch. did you remove your old version before installing? can you try again

@ashwinramdas12
Copy link

I copied and pasted the pip install line you sent. It says I now have version 2.0.3 installed. I'll try uninstalling and reinstalling with what you sent and then try again

@ashwinramdas12
Copy link

ashwinramdas12 commented May 4, 2020

image

For reference, the above is what I'm testing for the template. Don't know if that affects anything, but just making sure. what I actually want to make copies from is more complicated with equations and such, but I'm just trying this for now.

@ashwinramdas12
Copy link

@nithinmurali Still blank upon uninstall, reinstall and retry.

@nithinmurali
Copy link
Owner

@ashwinramdas12 the data in the sheet shouldn't matter, its copying the whole file. i just tested installing from scratch and its working fine. somehow you are not getting the latest version. maybe the pip is using old cache

pip install --no-cache-dir https://github.com/nithinmurali/pygsheets/archive/staging.zip
check the install logs to see if its actually installing.

if these also dosen't work your only option is to clone and install from source.

@ashwinramdas12
Copy link

ashwinramdas12 commented May 4, 2020

@nithinmurali Okay I think I must have the latest now. Now it is throwing an error instead of making a new sheet, but that at least must mean I have finally updated it. Here is the error:

image

@nithinmurali
Copy link
Owner

okay. Again i couldn't reproduce it. Is this the complete stacktrace? I cant see the key 'parents' used anywhere.

@ashwinramdas12
Copy link

@nithinmurali When I created a new jupyter notebook and ran my code it worked! Thank you so much for your help.

@cuchoi
Copy link

cuchoi commented Jul 14, 2020

Hi @ashwinramdas12, do we still need to install from staging to be able to use the template?

@cuchoi
Copy link

cuchoi commented Jul 16, 2020

It seems that it is still needed, are there any plans for a new release that will include this?

Thanks for building this great library!

@Tomzer42-zz
Copy link

Hello everybody,

I also need to create a spreadsheet from a template and as everybody I only got a blank sheet with the correct sheet name.
Does anyone know if a release is planned to fix this bug?

Thanks to other features I successed in copy/pasting the values and the format of the template but it's much longer...

Have a great week,
Tom

@nithinmurali
Copy link
Owner

@Tomzer42-zz
Copy link

Thank you very much !!!!!

It's working now :)

Thanks again for this very useful package.

Have a nice day,
Tom

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

8 participants