SD and ADXL345 together on SPI

Dear colleagues,
I have googled far and wide and found no working code that would hook up SD logger and ADXL accelerometer on SPI bus.

In one loop I need to get the G-reading and write it to the SD.

I got working codes for ADXL alone on SPI as well as SD alone on SPI. I believe I figured out how to do the wiring.
However I have no clue how to code the combination.

So my basic question is how to combine attached codes?

note: I did a variant with I2C. However it is too slow (15HZ) for me, I need at least 60HZ of data.

ADXL345SPI10.ino (4.06 KB)

SDLogonly.ino (2.25 KB)

Ugh. A F**ing breadboard diagram.

Both those devices are 3.3V only and the Mega is 5V. You need level shifters or resistors at the very least.

Look at other data logger projects. This is a very common requirement. Lots of people have done this before.