Best answer

How can I use Zapier to convert the xlsx file to CSV?


Userlevel 1

When I download an xlsx file, I can save it to OneDrive or Google Drive. That’s a manual step which works fine.

 

How can I then use Zapier to convert the xlsx file to csv? Been round many circles on this one and always seem to hit a dead end.

Thoughts very welcome!

icon

Best answer by swm 29 April 2024, 20:27

View original

20 replies

Userlevel 7
Badge +14

Hi @swm 

The GDrive Upload files step will return a CSV export link you can use

 

Here’s how:

https://community.zapier.com/show%2Dtell%2D5/gdrive%2Dfile%2Dlink%2Dformats%2Dgsheets%2Dgdocs%2Dgslides%2D25077

 

 

Userlevel 1

Thank you - still struggling!

I can pick up the xlsx file from OneDrive in Zapier, and then upload that to GD using the Upload File to GD step, which then creates a gsheet in GD.

I don’t know how to pull out the FILE_ID from GD in step 2 and use this to upload a csv back to OneDrive.

Userlevel 7
Badge +14

@swm 

Help:

 

Userlevel 1

For anyone else struggling, attached is how I got it to work

 

 

Userlevel 7
Badge +6

That’s awesome @swm! Thank you for sharing your Zap setup with us. This will be very helpful to our Community members. A big thank you to Troy for assisting you as well.

If you have any other questions, please don’t hesitate to reach out to the Community. We’re always happy to help! 🤗

Userlevel 1

For anyone else struggling, attached is how I got it to work

 

 

Wouldn’t https://drive.google.com/spreadsheets/d/[id]/export?format=csv require a login?
While I can download the CSV in the browser using that url, using zapier just results in a “The app returned "Unauthorized".” error...


 

Userlevel 7
Badge +11

Hi @Clemens Lode 👋

I’d have thought that if you’re using the Replace File action as talked about in this thread then it should be able to access the csv version of the file. As it would be connecting with your Google Account so the permissions should be correct.

Is it that you’re going to be using the CSV export link with a different app? If so you may need to use an Add File Sharing Preference (Google Drive) action set to Anyone on the internet who has the link can view. This would make the file publicly-accessible to anyone with the link.

Hope that helps! If you run into further issues please do let us know - happy to assist further! 

Userlevel 1

Hi @Clemens Lode 👋

I’d have thought that if you’re using the Replace File action as talked about in this thread then it should be able to access the csv version of the file. As it would be connecting with your Google Account so the permissions should be correct.

Is it that you’re going to be using the CSV export link with a different app? If so you may need to use an Add File Sharing Preference (Google Drive) action set to Anyone on the internet who has the link can view. This would make the file publicly-accessible to anyone with the link.

Hope that helps! If you run into further issues please do let us know - happy to assist further! 



Hi!

Ah, that makes sense. I didn’t think about it due to security concerns, but I can immediately remove the file after it was created. Also, changing the file sharing preferences of the folder instead of the file allows access to any newly uploaded file as well :)

So it’s:

  • Set up upload directory in google drive (→ anyone on the internet who has the link can view)
  • Set up output directory in google drive (private)
  • Create zapier google drive trigger (new file in upload directory)
  • Create zapier google drive action step (replace file)
  • Create zapier google drive action step
    • File id: ID

 

Result: CSV converted, original file no longer available :)

It’s still not 100% safe, but one could eventually change the replace action with a proper API call in python, but it’s more work.

Thanks a lot!

Userlevel 7
Badge +11

You’re welcome, @Clemens Lode! 🤗

Sounds like you’re all set for now but do reach out in the Community again if you need any further help in future. In the meantime, happy Zapping! ⚡ 

Hi @Clemens Lode 👋

I’d have thought that if you’re using the Replace File action as talked about in this thread then it should be able to access the csv version of the file. As it would be connecting with your Google Account so the permissions should be correct.

Is it that you’re going to be using the CSV export link with a different app? If so you may need to use an Add File Sharing Preference (Google Drive) action set to Anyone on the internet who has the link can view. This would make the file publicly-accessible to anyone with the link.

Hope that helps! If you run into further issues please do let us know - happy to assist further! 

Hello! I’m trying to automatically convert a xls file when uploaded in my gdrive from an email received. 
I’ve set a file sharing preference before doing the Replace File and it goes to a 404 Error when testing out. 

 

Userlevel 1

@wholeofthemoonamarketing  Can you try to set the file sharing of the directory manually in google drive and test it with the URL you are trying to use in the fourth step?

got a different error now

The app returned "Page Not Found.goog-inline-block{position:relative;display:-moz-inline-box;display:inline-block}* html .goog-inline-block{display:inline}*:first-child+html .goog-inline-block{display:inline}#drive-log...". Page Not Found.goog-inline-block{position:relative;display:-moz-inline-box;display:inline-block}* html .goog-inline-block{display:inline}*:first-child+html .goog-inline-block{display:inline}#drive-logo{margin:18px 0;position:absolute;white-space:nowrap}.docs-drivelogo-img{background-image:url(//ssl.gstatic.com/images/branding/googlelogo/1x/googlelogo_color_116x41dp.png);-webkit-background-size:116px 41px;background-size:116px 41px;display:inline-block;height:41px;vertical-align:bottom;width:116px}.docs-drivelogo-text{color:#000;display:inline-block;opacity:.54;text-decoration:none;font-family:"Product Sans",Arial,Helvetica,sans-serif;font-size:32px;text-rendering:optimizeLegibility;position:relative;top:-6px;left:-7px;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}@media (-webkit-min-device-pixel-ratio:1.5),(min-resolution:144dpi){.docs-drivelogo-img{background-image:url(//ssl.gstatic.com/images/branding/googlelogo/2x/googlelogo_color_116x41dp.png)}}sentinel{}body {background-color: #fff; font-family: Arial,sans-serif; font-size: 13px; margin: 0; padding: 0;}a, a:link, a:visited {color: #112ABB;}.errorMessage {font-size: 12pt; font-weight: bold; line-height: 150%;}Sorry, unable to open the file at this time. Please check the address and try again. Get stuff done with Google DriveApps in Google Drive make it easy to create, store and share online documents, spreadsheets, presentations and more.Learn more at drive.google.com/start/apps.html {height: 100%; overflow: auto;}body {height: 100%; overflow: auto;}#outerContainer {margin: auto; max-width: 750px;}#innerContainer {margin-bottom: 20px; margin-left: 40px; margin-right: 40px; margin-top: 80px; position: relative;}”

 

 

Userlevel 1

You  would have to post your full list of parameters you send to Google in your zap. 404 means file not found, so you have probanly passed the wrong file name.

How do I exactly post my full list of parameters I send to Google in my zap?

Userlevel 1

You could post a screenshot of your zap step.

 

Userlevel 1

I can't test it without seeing the full parameters, so I'd suggest going through all the tests in the zap, checking if the URL exists that you pass as parameter, double checking if you have set the access right, and making sure the search file returns a valid Id. Alternatively, use the Id of step 2, except if you are searching for a different file.

I can't test it without seeing the full parameters, so I'd suggest going through all the tests in the zap, checking if the URL exists that you pass as parameter, double checking if you have set the access right, and making sure the search file returns a valid Id. Alternatively, use the Id of step 2, except if you are searching for a different file.

just a question, was the file you replaced an xls or google sheets file?

Userlevel 1

My zap gets triggered when a XSLX is uploaded to a directory, then I "replace" it and a CSV file is created in the target directory.

Is this how its supposed to end?

 

Reply